Re: how to do Unix copy command with temp file

2022-02-08 Thread Paul Gilmartin
On Tue, 8 Feb 2022 18:27:04 +, Billy Ashton wrote:

>gil, I tried IEBGENER, but my test (copy to Unix using Gener, then copy 
>back to MVS file using Gener, then compare) failed with anything other 
>than text files (Ascii), but that might have been due to Path settings 
>or Filedata settings (too many iterations ago to remember).
> 
Due diligence.  Would DD FILEDATA=BINARY) make a difference?
Were you able to perform a similar verification using SORT?

>The delete is not necessary, and I could do the overwrite--it just 
>seemed cleaner to do it that way...I will review that again for 
>simplicity. And the /tmp directory suggestion about another subdir is a 
>good one-thanks!
> 
It's an MVS mindset:
DISP=OLD fails if the data set does not exist.
DISP=NEW fails if the data set exists.
DISP=MOD appends rather than overwriting.
So the MVS tradition is to add an extra step with either
DISP=(MOD,DELETE) or DISP=(MOD,CATLG) to get a known state.
But with a UNIX mindset it's puzzling; PATHOPTS=(OCREAT,OTRUNC)
suffices.

>Finally !cp is not a negate...in sftp, the bang means to run a shell 
>command within the sftp active environment. So here, !cp is running a 
>shell Copy command to copy the MVS file to Unix (still trying to work 
>that out with return code testing).
>
Ah! I've known non-IBM FTP clients that use "|" for that.

-- 
Thanks,
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Seymour J Metz
Yeah, reading between the lines is unreliable.

Do you have a chron job to prune your $TMPDIR?


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of 
Paul Gilmartin [000433f07816-dmarc-requ...@listserv.ua.edu]
Sent: Tuesday, February 8, 2022 12:17 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: how to do Unix copy command with temp file

On Tue, 8 Feb 2022 16:19:16 +, Seymour J Metz wrote:

>Then you only need two steps; you can create a new temporary dataset in the 
>AMATERSE step and a (maybe) new Unix file in the send step.
>
He never explained the need to delete an existing file rather than just
overwriting it.  But there are plausible reasons such as ownership,
permissions, and extended attributes.

My ~/.profile creates a $TMPDIR peculiar to my user name and
writable only by me, to prevent meddling.

--
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Sri h Kolusu
> Why SORT rather than IEBGENER?
> o I wouldn't expect Kolusu to suggest anything else.

Gil,

It is true that I am more inclined towards SORT as I am a developer of it
but at the same time, I am a firm believer of using right tool for the
right job. In this case SORT definitely outperforms IEBGENER

> o A co-worker long ago told me that SYNCGENR outperforms IEBGENER.

For the record the DFSORT's version of ICEGENER  also outperforms IEBGENER


Thanks,
Kolusu

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Billy Ashton
gil, I tried IEBGENER, but my test (copy to Unix using Gener, then copy 
back to MVS file using Gener, then compare) failed with anything other 
than text files (Ascii), but that might have been due to Path settings 
or Filedata settings (too many iterations ago to remember).


The delete is not necessary, and I could do the overwrite--it just 
seemed cleaner to do it that way...I will review that again for 
simplicity. And the /tmp directory suggestion about another subdir is a 
good one-thanks!


Finally !cp is not a negate...in sftp, the bang means to run a shell 
command within the sftp active environment. So here, !cp is running a 
shell Copy command to copy the MVS file to Unix (still trying to work 
that out with return code testing).


Thank you and best regards,
Billy Ashton

-- Original Message --

From "Paul Gilmartin" <000433f07816-dmarc-requ...@listserv.ua.edu>

To IBM-MAIN@listserv.ua.edu
Date 2/8/2022 1:19:19 PM
Subject Re: how to do Unix copy command with temp file


On Tue, 8 Feb 2022 17:50:15 +, Billy Ashton wrote:


Hi gil, here is what we do:
1. Run an inhouse program that massages several files and creates one (possibly) large 
file (&Untersedfile).
2. Terse that large file (&Tersedfile)
3. Pre-emptively delete the Unix file (this is the new step)


Is delete necessary?  (Does sort require a new (pathopts=OEXCL) file?


4. PGM=SORT to copy that file to Unix (as /tmp/tempfile.txt (actually, a more 
meaningful name is used).


Why SORT rather than IEBGENER?
o I wouldn't expect Kolusu to suggest anything else.
o A co-worker long ago told me that SYNCGENR outperforms IEBGENER.
o Bur IEBGENER will copy attributes from SYSUT1 to SYSUT2.
o I suggest a private subdirectory of /tmp, with a meaningful name.


5. Run sftp to transfer it to a remote server at another company.

I thought I had referenced my #4 solution previously, but in any case, Kolusu gave me a 
SORT OPTION=COPY step that will create the Unix file I need. Sort wants the DCB info for 
both sides of the copy, which is not a problem as these attributes don't change. I am 
also considering adding a !cp command to my Sftp script instead of the separate step, but 
don't know how to test for success of that !cp command before doing the "put" 
command. I am still researching that, as I am not a very good shell programmer.


What's "!cp"?  I don't understand the "!"
Ah!  on further review, shell negation.

Perhaps:
   if cp ...
   then
   sftp ...
   else
   echo "cp failed with status $?." >&2
   fi
Or:
   cp ... || {
   echo "cp failed with status $?." >&2
   exit 1; }
   sftp ...

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Paul Gilmartin
On Tue, 8 Feb 2022 17:50:15 +, Billy Ashton wrote:

>Hi gil, here is what we do:
>1. Run an inhouse program that massages several files and creates one 
>(possibly) large file (&Untersedfile).
>2. Terse that large file (&Tersedfile)
>3. Pre-emptively delete the Unix file (this is the new step)
>
Is delete necessary?  (Does sort require a new (pathopts=OEXCL) file?

>4. PGM=SORT to copy that file to Unix (as /tmp/tempfile.txt (actually, a 
>more meaningful name is used).
>
Why SORT rather than IEBGENER?
o I wouldn't expect Kolusu to suggest anything else.
o A co-worker long ago told me that SYNCGENR outperforms IEBGENER.
o Bur IEBGENER will copy attributes from SYSUT1 to SYSUT2.
o I suggest a private subdirectory of /tmp, with a meaningful name.

>5. Run sftp to transfer it to a remote server at another company.
>
>I thought I had referenced my #4 solution previously, but in any case, 
>Kolusu gave me a SORT OPTION=COPY step that will create the Unix file I 
>need. Sort wants the DCB info for both sides of the copy, which is not a 
>problem as these attributes don't change. I am also considering adding a 
>!cp command to my Sftp script instead of the separate step, but don't 
>know how to test for success of that !cp command before doing the "put" 
>command. I am still researching that, as I am not a very good shell 
>programmer.
>
What's "!cp"?  I don't understand the "!"
Ah!  on further review, shell negation.

Perhaps:
if cp ...
then
sftp ...
else
echo "cp failed with status $?." >&2
fi
Or:
cp ... || {
echo "cp failed with status $?." >&2
exit 1; }
sftp ...

-- 
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Billy Ashton

Hi gil, here is what we do:
1. Run an inhouse program that massages several files and creates one 
(possibly) large file (&).

2. Terse that large file (&)
3. Pre-emptively delete the Unix file (this is the new step)
4. PGM=SORT to copy that file to Unix (as /tmp/tempfile.txt (actually, a 
more meaningful name is used).

5. Run sftp to transfer it to a remote server at another company.

I thought I had referenced my #4 solution previously, but in any case, 
Kolusu gave me a SORT OPTION=COPY step that will create the Unix file I 
need. Sort wants the DCB info for both sides of the copy, which is not a 
problem as these attributes don't change. I am also considering adding a 
!cp command to my Sftp script instead of the separate step, but don't 
know how to test for success of that !cp command before doing the "put" 
command. I am still researching that, as I am not a very good shell 
programmer.


Thank you and best regards,
Billy Ashton

-- Original Message --

From "Paul Gilmartin" <000433f07816-dmarc-requ...@listserv.ua.edu>

To IBM-MAIN@listserv.ua.edu
Date 2/8/2022 12:04:56 PM
Subject Re: how to do Unix copy command with temp file


On Tue, 8 Feb 2022 16:06:35 +, Billy Ashton wrote:


gil, the reason I cannot write directly is that in one case, after creating my 
file, I run it through AMATERSE to shrink it, and AMATERSE cannout output to 
the Unix file. So in this case, I need to write to a temp file, then copy it to 
Unix where I can send it.


Do you ever need both the TERSE instance and the sftp instance?  If
you need only one you can select whether to allocate a temp DSN or
a UNIX file.

If your data set is large it might be desirable to avoid creating a large
UNIX file.  Sftp just executes a monitor program at the remote site.
Instead of sftp you might be able to:
   cp //temp.dsn /dev/fd/1 |ssh user@remotehost " set -x; cat 
>remote.file.txt"

(Yo never said how you solved the original "cp" problem.)

Are you allowed to use Dovetailed Co:Z?

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Paul Gilmartin
On Tue, 8 Feb 2022 16:19:16 +, Seymour J Metz wrote:

>Then you only need two steps; you can create a new temporary dataset in the 
>AMATERSE step and a (maybe) new Unix file in the send step.
> 
He never explained the need to delete an existing file rather than just
overwriting it.  But there are plausible reasons such as ownership,
permissions, and extended attributes.

My ~/.profile creates a $TMPDIR peculiar to my user name and
writable only by me, to prevent meddling.

-- 
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Billy Ashton
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 
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" <000433f07816-dmarc-requ...@listserv.ua.edu>

To IBM-MAIN@listserv.ua.edu
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 +, 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Paul Gilmartin
On Tue, 8 Feb 2022 16:06:35 +, Billy Ashton wrote:

>gil, the reason I cannot write directly is that in one case, after 
>creating my file, I run it through AMATERSE to shrink it, and AMATERSE 
>cannout output to the Unix file. So in this case, I need to write to a 
>temp file, then copy it to Unix where I can send it.
> 
Do you ever need both the TERSE instance and the sftp instance?  If
you need only one you can select whether to allocate a temp DSN or
a UNIX file.

If your data set is large it might be desirable to avoid creating a large
UNIX file.  Sftp just executes a monitor program at the remote site.
Instead of sftp you might be able to:
cp //temp.dsn /dev/fd/1 | 
ssh user@remotehost " set -x; cat >remote.file.txt"

(Yo never said how you solved the original "cp" problem.)

Are you allowed to use Dovetailed Co:Z?

-- 
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Carmen Vitullo
after I saw Gil's suggestion, I thought this was a better approach myself -

Carmen 


On Tue, 8 Feb 2022 16:09:35 +, Billy Ashton  wrote:

>Hi Carmen, I am going to give gil's method a try first, as it is simple 
>enough to keep inside a BR14, and failing that, I will go with the shell 
>command. Thanks for the suggestion!
>
>Thank you and best regards,
>Billy Ashton
>
>-- Original Message --
>From "Carmen Vitullo" 
>To IBM-MAIN@listserv.ua.edu
>Date 2/8/2022 8:29:11 AM
>Subject Re: how to do Unix copy command with temp file
>
>>On Tue, 8 Feb 2022 13:01:14 +, Billy Ashton  
>>wrote:
>>
>>>Ok, here is a followup question from a problem I ran into...
>>>
>>>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.
>>>
>>>Ideally, I should not need this, but want to ensure that this file is not 
>>>there when I start my processing.
>>>
>>>Thank you and best regards,
>>>Billy Ashton
>>>
>>>--
>>>For IBM-MAIN subscribe / signoff / archive access instructions,
>>>send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>>
>>
>>use the bpxbatch program and parm='sh rm /tmp/tempfile.txt' or for MVS 
>>datasets that may or not exists you should use a DISP=(MOD,DELETE,DELETE)
>>correct the parms for your use, but this should work Carmen
>>
>>--
>>For IBM-MAIN subscribe / signoff / archive access instructions,
>>send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
>--
>For IBM-MAIN subscribe / signoff / archive access instructions,
>send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Seymour J Metz
Then you only need two steps; you can create a new temporary dataset in the 
AMATERSE step and a (maybe) new Unix file in the send step.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of 
Billy Ashton [bill00ash...@gmail.com]
Sent: Tuesday, February 8, 2022 11:06 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: how to do Unix copy command with temp file

gil, the reason I cannot write directly is that in one case, after
creating my file, I run it through AMATERSE to shrink it, and AMATERSE
cannout output to the Unix file. So in this case, I need to write to a
temp file, then copy it to Unix where I can send it.

Thank you and best regards,
Billy Ashton

-- Original Message --
>From "Paul Gilmartin" <000433f07816-dmarc-requ...@listserv.ua.edu>
To IBM-MAIN@listserv.ua.edu
Date 2/8/2022 9:11:38 AM
Subject Re: how to do Unix copy command with temp file

>On Tue, 8 Feb 2022 13:01:14 +, Billy Ashton wrote:
>>...
>>Ideally, I should not need this, but want to ensure that this file is not 
>>there when I start my processing.
>>
>You wrote earlier that you wrote first to a Classic temp data set,
>then copy that to a temp UNIX file.  Why can you not write
>directly to the UNIX file?  Can you show your code, at least the
>part that allocates the temp data set?
>
>-- gil
>
>--
>For IBM-MAIN subscribe / signoff / archive access instructions,
>send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Billy Ashton
Hi Carmen, I am going to give gil's method a try first, as it is simple 
enough to keep inside a BR14, and failing that, I will go with the shell 
command. Thanks for the suggestion!


Thank you and best regards,
Billy Ashton

-- Original Message --

From "Carmen Vitullo" 

To IBM-MAIN@listserv.ua.edu
Date 2/8/2022 8:29:11 AM
Subject Re: how to do Unix copy command with temp file


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


Ok, here is a followup question from a problem I ran into...

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.

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

Thank you and best regards,
Billy Ashton

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN



use the bpxbatch program and parm='sh rm /tmp/tempfile.txt' or for MVS datasets 
that may or not exists you should use a DISP=(MOD,DELETE,DELETE)
correct the parms for your use, but this should work Carmen

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Billy Ashton
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" <000433f07816-dmarc-requ...@listserv.ua.edu>

To IBM-MAIN@listserv.ua.edu
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 +, 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Billy Ashton
gil, the reason I cannot write directly is that in one case, after 
creating my file, I run it through AMATERSE to shrink it, and AMATERSE 
cannout output to the Unix file. So in this case, I need to write to a 
temp file, then copy it to Unix where I can send it.


Thank you and best regards,
Billy Ashton

-- Original Message --

From "Paul Gilmartin" <000433f07816-dmarc-requ...@listserv.ua.edu>

To IBM-MAIN@listserv.ua.edu
Date 2/8/2022 9:11:38 AM
Subject Re: how to do Unix copy command with temp file


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

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


You wrote earlier that you wrote first to a Classic temp data set,
then copy that to a temp UNIX file.  Why can you not write
directly to the UNIX file?  Can you show your code, at least the
part that allocates the temp data set?

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Paul Gilmartin
On Tue, 8 Feb 2022 13:01:14 +, Billy Ashton wrote:
>...
>Ideally, I should not need this, but want to ensure that this file is 
>not there when I start my processing.
> 
You wrote earlier that you wrote first to a Classic temp data set,
then copy that to a temp UNIX file.  Why can you not write
directly to the UNIX file?  Can you show your code, at least the
part that allocates the temp data set?

-- 
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Paul Gilmartin
On Tue, 8 Feb 2022 13:01:14 +, 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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Carmen Vitullo
On Tue, 8 Feb 2022 13:01:14 +, Billy Ashton  wrote:

>Ok, here is a followup question from a problem I ran into...
>
>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.
>
>Ideally, I should not need this, but want to ensure that this file is 
>not there when I start my processing.
>
>Thank you and best regards,
>Billy Ashton
>
>--
>For IBM-MAIN subscribe / signoff / archive access instructions,
>send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


use the bpxbatch program and parm='sh rm /tmp/tempfile.txt' or for MVS datasets 
that may or not exists you should use a DISP=(MOD,DELETE,DELETE)
correct the parms for your use, but this should work 
Carmen

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-08 Thread Billy Ashton

Ok, here is a followup question from a problem I ran into...

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.


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


Thank you and best regards,
Billy Ashton

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-03 Thread Paul Gilmartin
On Thu, 3 Feb 2022 17:37:11 +, Billy Ashton wrote:
>
>I have a process that takes input from several standard MVS files, and 
>creates a temporary file (sometimes small, sometimes ginormous). Our 
>shop is using SFTP to send files to another server, and I am not sure 
>how to code the "cp" command to put this temp file into an HFS directory 
>so I can send it. I can work with standard, catalogued files without a 
>problem, but was hoping i could use a temp file here.
> 
I neglected to mention Co:Z:


-- 
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-03 Thread Paul Gilmartin
On Thu, 3 Feb 2022 17:37:11 +, Billy Ashton  wrote:
>
>I have a process that takes input from several standard MVS files, and 
>
Help the list to help you by describing your "process".  It might be as
simple as:
//CAT  EXEC PGM=IEBGENER
//SYSUT1  DD  DSN=first.data.set
//DD  DSN=second.data.set
//  ...
//SYSUT2  DD  PATH='unix.file',...

The "unix.file" might even be a named pipe to sftp or ssh lurking in background.

>creates a temporary file (sometimes small, sometimes ginormous). Our 
>
Temp files can cause problems because UNIX fork or BPXBATCH creates
a new child ASID lacking allocations of the formeer.

>shop is using SFTP to send files to another server, and I am not sure 
>how to code the "cp" command to put this temp file into an HFS directory 
>so I can send it. I can work with standard, catalogued files without a 
>problem, but was hoping i could use a temp file here.
>
>What do y'all think? Can I do a cp command with a temp file, or do I 
>need to have a catalogued file?

-- 
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-03 Thread Radoslaw Skorupka

Try Irish commands.
OCOPY can copy to/from file, ps dataset, member...
Both input and output are ddnames. Note, ddname can be used for files as 
well.


--
Radoslaw Skorupka
Lodz, Poland




W dniu 03.02.2022 o 18:37, Billy Ashton pisze:

Here is a simple question that has a simple answer - I hope!

I have a process that takes input from several standard MVS files, and 
creates a temporary file (sometimes small, sometimes ginormous). Our 
shop is using SFTP to send files to another server, and I am not sure 
how to code the "cp" command to put this temp file into an HFS 
directory so I can send it. I can work with standard, catalogued files 
without a problem, but was hoping i could use a temp file here.


What do y'all think? Can I do a cp command with a temp file, or do I 
need to have a catalogued file?


Thank you and best regards,
Billy Ashton


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: how to do Unix copy command with temp file

2022-02-03 Thread Carmen Vitullo
I'm not sure of your invocation, but maybe the OCOPY command could be 
useful ?


Carmen

On 2/3/2022 11:37 AM, Billy Ashton wrote:

Here is a simple question that has a simple answer - I hope!

I have a process that takes input from several standard MVS files, and 
creates a temporary file (sometimes small, sometimes ginormous). Our 
shop is using SFTP to send files to another server, and I am not sure 
how to code the "cp" command to put this temp file into an HFS 
directory so I can send it. I can work with standard, catalogued files 
without a problem, but was hoping i could use a temp file here.


What do y'all think? Can I do a cp command with a temp file, or do I 
need to have a catalogued file?


Thank you and best regards,
Billy Ashton

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


--
/I am not bound to win, but I am bound to be true. I am not bound to 
succeed, but I am bound to live by the light that I have. I must stand 
with anybody that stands right, and stand with him while he is right, 
and part with him when he goes wrong. *Abraham Lincoln*/


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN