Check for file existence

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
pnguyen2020
Posts: 3
Joined: Tue Jun 16, 2020 7:42 am

Check for file existence

Post by pnguyen2020 »

I want to issue the lrecl directive on a file only if the file does not exist. Is it possible to check for the existence of a file in sftp?
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Check for file existence

Post by dovetail »

If you do this from a remote SFTP client connected to Co:Z SFTP server:

ls /+recfm=fb,lrecl=1028,space=cyl.2.1
put local.file //HLQ.DSN

- The recfm, lrecl, space settings will only be used if the data set does not exist.

See table B.3 here: https://dovetail.com/docs/sftp/options. ... ns_bpxwdyn
If you note, most allocation options do not apply for writing to existing data sets.
Post Reply