RosettaCodeData/Task/Check-that-file-exists/DBL/check-that-file-exists.dbl
2023-07-01 13:44:08 -04:00

35 lines
1,014 B
Text

;
; 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