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  


;
;       Check file and directory exists for DBL version 4 by Dario B.
;
        PROC
;------------------------------------------------------------------
        XCALL FLAGS (0007000000,1)              ;Suppress STOP message
 
        CLOSE 1
        OPEN (1,O,'TT:')
 
        ;The file path can be written as:
        ;  "input.txt"                  (current directory)
        ;  "/directory/input.txt"       (complete path)
        ;  "DEV:input.txt"              (device DEV defined in shell)
        ;  "$DEV/input.txt"             (device DEV defined in shell)
        CLOSE 2
        OPEN (2,I,"input.txt")  [ERR=NOFIL]
        CLOSE 2
 
        ;Check directory (unix/linux systems)
        CLOSE 2
        OPEN (2,O,"/docs/.")    [ERR=NODIR]
 
        GOTO CLOS
 
;--------------------------------------------------------
NOFIL,  DISPLAY (1,"File input.txt not found!",10)
        GOTO CLOS
 
NODIR,  DISPLAY (1,"Directory /docs not found!",10)
        GOTO CLOS
 
CLOS,   CLOSE 1
        CLOSE 2
        STOP