On Wed, 14 Apr 2021 19:12:40 +0000, Billy Ashton <[email protected]> wrote:

>cases. The file is pretty large, and the support tech said I have to 
>copy it to OMVS to use SFTP for uploading it. I am not sure I have that 
>space available on the other side, so I was wondering if anyone here has 
>a BPX batch job that will send a file to CA or Broadcom from the z/OS 
>file without having to first copy the file to my Unix filesystem.
>

Co:Z saved my b.t many times over... 

•• PROTECTED 関係者外秘

//myuserF JOB 'Jantje','SFTP',
//             MSGLEVEL=(1,1),CLASS=C,MSGCLASS=X,
//             NOTIFY=&SYSUID
//*
//         SET ENV=D
//*
//*-----------------------------------------------------------
//* Send a file to the Linux server.                 -
//*-----------------------------------------------------------
//*
//PUTSFTP  PROC LOGIN=,PASS=,SERVER=,INFILE=
//*
//SAVLOGIN EXEC PGM=COZBATCH,REGION=64M,
// PARM='/remoteuser=&LOGIN'
//STEPLIB  DD  DISP=SHR,DSN=COZ.LOADLIB.COZ
//SAVEARGS DD  DISP=(,PASS),DSN=&&amp;SAVEARG
//*
//SAVPASS  EXEC PGM=COZBATCH,REGION=64M,
// PARM='/PASSWD_DSN=MY.PDS.CNTL(&PASS)'
//STEPLIB  DD  DISP=SHR,DSN=COZ.LOADLIB.COZ
//SAVEARGS DD  DISP=(OLD,PASS),DSN=&&amp;SAVEARG
//*
//SAVIFILE EXEC PGM=COZBATCH,REGION=64M,
// PARM='/INFILE=&INFILE'
//STEPLIB  DD  DISP=SHR,DSN=COZ.LOADLIB.COZ
//SAVEARGS DD  DISP=(OLD,PASS),DSN=&&amp;SAVEARG
//*
//SAVSRVR  EXEC PGM=COZBATCH,REGION=64M,
// PARM='/server=&SERVER'
//STEPLIB  DD  DISP=SHR,DSN=COZ.OADLIB.COZ
//SAVEARGS DD  DISP=(OLD,PASS),DSN=&&amp;SAVEARG
//*
//RUNSFTP  EXEC PGM=COZBATCH,REGION=64M
//STEPLIB  DD  DISP=SHR,DSN=COZ.LOADLIB.COZ
//SAVEARGS DD  DISP=(OLD,DELETE),DSN=&&amp;SAVEARG
//STDIN    DD  *
# Add CO:Z to the PATH.
export PATH=/coz/coz-2.4.3/bin:${PATH}

# These are used to read the ssh password from a (secured) dataset
export SSH_ASKPASS=read_passwd_dsn.sh
export DISPLAY=none

ssh_opts="-oBatchMode=no"      # allows ssh to use SSH_ASKPASS program
ssh_opts="$ssh_opts -oConnectTimeout=60"
ssh_opts="$ssh_opts -oServerAliveInterval=60"
##h_opts="$ssh_opts -oStrictHostKeyChecking=no" # accept initial host ke

# Invoke the Co:Z sftp client with an in-line batch of commands
# Note that "-oBatchMode=no" must be specified before "-b"
#      since ssh opts are first-sticky
cozsftp  $ssh_opts -b - $remoteuser@$server <<EOB
//         DD  DDNAME=INPUT
//         DD  *
EOB
//         PEND
//*
//TRANSFER EXEC PUTSFTP,
//             LOGIN='Jantje',
//             PASS=SOMEPASS,
//             SERVER=LXJ2E&ENV.01.MY.COM,
//             INFILE=HLQ&ENV..SOME.REPORT(0)
//RUNSFTP.INPUT    DD  *
# Set any required options first.
lzopts servercp="ISO8859-1"
lzopts mode=text,overflow=trunc
lzopts lrecl=255,recfm=fb,notrim
lzopts
# Now go to the destination directory.
cd /opt/apps/Test/work
ls -al
# and put the file.
PUT '//$INFILE' cwsTestFile.txt
ls -al


This is just one incarnation. I have permutations where iconv is used to 
convert EBCDIC to ASCII, some use fromdsn to get (and convert) the data from a 
dataset... All thanks to Co:Z and a bit of Unix shell scripting thereof.

Cheers,

Jantje.


P.S. Apart from being a very happy user of their excellent products, I have no 
link with Dovetailed.

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

Reply via email to