We are using cozbatch on MVS to invoke SFTP. If we want to put an MVS text file in text mode to a unix or windows sftp server does cozbatch handle the EBCDIC to ASCII conversion?
If not I guess the text file would have to be zipped, then it's not a text file. Any other suggestions? Thanks Matt
SFTP And MVS Text Files
If you use COZBATCH to invoke the CO:Z SFTP command (client), then Co:Z SFTP will handle the conversion of text datasets.
To control this, you need to set the Co:Z SFTP client options using the "lzopts" command. See: http://dovetail.com/docs/sftp/client.html#client_opts
For example, in your COZBATCH job you could have the following:
(refer to "RUNSFTP" sample JCL for a complete example, which shows how to set the variables).
If not specified, the servercp defaults to "ISO8859-1" for the Co:Z SFTP client, unless it detects that the server is a z/OS system running Co:Z sftp, in which case they exchange their default codepages.
There are other options that you can use to control how dataset records are converted to a stream of bytes on the remote file when you have "mode=text" enabled. These include "localcp", "trim", and "linerule". The defaults will give you what most people expect as normal text conversion of a z/OS dataset. If the target is a Windows box, you might want to set "linerule=crlf", since the default is just a newline(linefeed).
To control this, you need to set the Co:Z SFTP client options using the "lzopts" command. See: http://dovetail.com/docs/sftp/client.html#client_opts
For example, in your COZBATCH job you could have the following:
Code: Select all
$coz_bin/cozsftp $ssh_opts -b- $remoteuser@$server <<EOB
lzopts mode=text,servercp=$servercp
put //DD:MYDD $remotefile
EOB
If not specified, the servercp defaults to "ISO8859-1" for the Co:Z SFTP client, unless it detects that the server is a z/OS system running Co:Z sftp, in which case they exchange their default codepages.
There are other options that you can use to control how dataset records are converted to a stream of bytes on the remote file when you have "mode=text" enabled. These include "localcp", "trim", and "linerule". The defaults will give you what most people expect as normal text conversion of a z/OS dataset. If the target is a Windows box, you might want to set "linerule=crlf", since the default is just a newline(linefeed).
This was fixed in a recent release (1.8.0):
http://dovetail.com/docs/cozinstall/changes.html
http://dovetail.com/docs/cozinstall/changes.html
We have the variable in the lzopts and do the over ride in the jcl. If a user puts the 'text' in capitols the ebcdic to ascii is not done and we do not get any msg that the 'TEXT' format was not accepted. tks
lzopts mode=$TRANSFER,servercp=$servercp
//SFTPQCK EXEC SFTPMDX,
// PUTORGET=PUT,
// PUTMVS='NULLFILE',
// GETMVS='NULLFILE',
// FN=,
// LRECL=242,
// RECFM=FB,
// PWDPDS='ST1MAT.CNTL(PW)',
// LIB2='ST1MAT.CNTL',
// SITE1=SFTPASS,
// FTPWTO='NULLFILE',
// TRANSFER='text'
//QUICKJOB.SYSINB DD DSN=ST1MAT.CNTL.SFTP(CMDS)
lzopts mode=$TRANSFER,servercp=$servercp
//SFTPQCK EXEC SFTPMDX,
// PUTORGET=PUT,
// PUTMVS='NULLFILE',
// GETMVS='NULLFILE',
// FN=,
// LRECL=242,
// RECFM=FB,
// PWDPDS='ST1MAT.CNTL(PW)',
// LIB2='ST1MAT.CNTL',
// SITE1=SFTPASS,
// FTPWTO='NULLFILE',
// TRANSFER='text'
//QUICKJOB.SYSINB DD DSN=ST1MAT.CNTL.SFTP(CMDS)
I understand.
As I said, this is due to a bug that was fixed, but here is a workaround until you install the fix:
I assume that you are passing the &TRANSFER JCL variable to COZBATCH into a like-named shell variable.
Add this to your shell script before invoking the cozsftp command ( case is sensitive):
TRANSFER=$(echo $TRANSFER | tr '[:upper:]' '[:lower:]')
As I said, this is due to a bug that was fixed, but here is a workaround until you install the fix:
I assume that you are passing the &TRANSFER JCL variable to COZBATCH into a like-named shell variable.
Add this to your shell script before invoking the cozsftp command ( case is sensitive):
TRANSFER=$(echo $TRANSFER | tr '[:upper:]' '[:lower:]')