Task

Verify that a file called     input.txt     and   a directory called     docs     exist.



This should be done twice:  

   once for the current working directory,   and
   once for a file and a directory in the filesystem root.


Optional criteria (May 2015):   verify it works with:

   zero-length files
   an unusual filename:     `Abdu'l-Bahá.txt  


*Process source or(!);
 /*********************************************************************
 * 20.10.2013 Walter Pachl
 * 'set dd:f=d:\_l\xxx.txt,recsize(300)'
 * 'tex'
 *********************************************************************/
 tex: Proc Options(main);
 Dcl fid Char(30) Var Init('D:\_l\tst.txt');
 Dcl xxx Char(30) Var Init('D:\_l\nix.txt');
 Dcl r   Char(1000) Var;
 Dcl f Record input;
 On Undefinedfile(f) Goto label;
 Open File(f) Title('/'!!fid);
 Read file(f) Into(r);
 Put Skip List('First line of file '!!fid!!': '!!r);
 Close File(f);
 Open File(f) Title('/'!!xxx);
 Read file(f) Into(r);
 Put Skip List(r);
 Close File(f);
 Label: Put Skip List('File '!!xxx!!' not found');
 End;