OK, gil, that worked perfectly. I see the messages in my JESYSMSG output
whether the file exists or not:
IGD103I SMS UNIX FILE ALLOCATED TO DDNAME DELTEMP
IEF142I SFTPTEST DELETE - STEP WAS EXECUTED - COND CODE 0000
IGD105I UNIX FILE WAS DELETED, DDNAME IS (DELTEMP )
FILENAME IS (/tmp/tempfile.txt)
Thanks again for your great suggestion!
B
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