gil, this looks like it will work well for me here. I will give this a try - creating and deleting is no issue to me, as the end result is that whether or not the file exists beforehand, it will not exist afterwards, and the process will not fail on a file not found.

Thanks for this!

Thank you and best regards,
Billy Ashton

------ Original Message ------
From "Paul Gilmartin" <[email protected]>
To [email protected]
Date 2/8/2022 8:59:34 AM
Subject Re: how to do Unix copy command with temp file

On Tue, 8 Feb 2022 13:01:14 +0000, Billy Ashton wrote:

Is there a simple command like IEFBR14 that will allow me to delete a USS path 
if it exists, or to just skip over it if not? Right now, if I run IEFBR14, and 
have a DD statement with a path like 
PATH='/tmp/tempfile.txt',PATHDISP=(DELETE,DELETE) and that file does not exist, 
I get a JCL error.

I believe that if you code:
   PATH='/tmp/tempfile.txt',PATHDISP=(DELETE,DELETE),PATHOPTS=(OCREAT,ORDWR)
You will not get the error.  It may momentarily create the file, then
delete it.  Is that objectionable.

Ideally, I should not need this, but want to ensure that this file is not there 
when I start my processing.

What is your requirement in detail?  If you code
   PATH='/tmp/tempfile.txt',PATHOPTS=(OCREAT,OTRUNC,ORDWR)
it will overwrite the file if it exists.  Is that satisfactory?

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to