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" <[email protected]>
To [email protected]
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 +0000, 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 [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