Check to see if file is open in OpenVMS before FTP/Append -


i have jobm in sag natural, creates workfiles. after created want append if there multiple , ftp them. append/ftp run independently of job creates them. poses problem of trying ftp/append file while being created.

is there syntax in openvms or in ftp can check see if file open/locked before continue on logic?

i not try open write... because may work, lock out others, , change revision date/count. instead try $open/read/share=read file ...

if opens, can use file handle read data, preventing other process (re-)opening between test , usage. using dcl io uses small buffer. example below shows fun: append file ... example hard-codes output because lazy. better of closing file on success first , use append/log.

enjoy, hein

$ output = "tmp.tmp" $ if p1.eqs."" exit 16 $ create tmp.tmp $ old = "" $loop: $ file_name = f$search(p1) $ if file_name .eqs. "" .or. file_name .eqs.old exit $ old = file_name ! handle non-wildcarded input $ close/nolog file $ open/read/share=read/erro=locked_or_other_error file 'file_name' $ append file tmp.tmp ! /log $ write sys$error "appended ", file_name $ close/nolog file $ goto loop $locked_or_other_error: $ write sys$error "found, not open file ", file_name $ goto loop 

Comments