Check for file existence

A 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 » Mon Jul 13, 2020 9:45 am

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: 1951
Joined: Thu Jul 29, 2004 12:12 pm

Re: Check for file existence

Post by dovetail » Mon Jul 13, 2020 2:54 pm

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