Problem with Put Statement Longer than 72 characters

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
mpeck
Posts: 3
Joined: Fri Jun 23, 2017 2:07 pm

Problem with Put Statement Longer than 72 characters

Post by mpeck »

I am having a problem with a PUT command that is currently spanning two lines in FTP, that I am converting to SFTP:

Current Command:

put //TEMP.G05DIRF.ENGFRE.big.mvsp +
g05dirf.sftp.big.mvs.txt1


Results:

cozsftp> lzopts mode=text,notrim
mode=text notrim
cozsftp> cd Outbox
cozsftp> put //TEMP.G05DIRF.ENGFRE.big.mvsp +
Uploading //TEMP.G05DIRF.ENGFRE.BIG.MVSP to /Outbox/+
ZosSettingsÝI¨: Transfer options: clientcp=IBM-1047,mode=text,servercp=ISO8859-
ZosDatasetÝI¨: Opening dataset TEMP.G05DIRF.ENGFRE.BIG.MVSP for read with optio
ZosDatasetÝI¨: Closing dataset //TEMP.G05DIRF.ENGFRE.BIG.MVSP - 0 records read,
Ý17.575¨ Invalid command.
cozsftp> g05dirf.sftp.big.mvs.txt1
CoZBatchÝI¨: returning rc=exitcode=1
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Problem with Put Statement Longer than 72 characters

Post by dovetail »

When you run the SFTPPROC, the SFTPIN DD input is processed by the z/OS Unix shell.

To continue lines in the z/OS Unix shell, you can use a trailing backslash '\' character
For example:

Code: Select all

put //TEMP.G05DIRF.ENGFRE.big.mvsp \
g05dirf.sftp.big.mvs.txt1
0c4
Posts: 5
Joined: Fri Sep 29, 2017 3:51 pm

Re: Problem with Put Statement Longer than 72 characters

Post by 0c4 »

Not to revive an old thread, but was this fixed in a certain release or version? currently running the SFTPPROC for CoZBatch on 4.2.0 and it appears the line continuation character does no work as described.

Can anyone else verify this?
0c4
Posts: 5
Joined: Fri Sep 29, 2017 3:51 pm

Re: Problem with Put Statement Longer than 72 characters

Post by 0c4 »

I have been able to get this by using a heredoc (<<EOB/EOB). without it , the line continuation will not work.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Problem with Put Statement Longer than 72 characters

Post by dovetail »

Try adding "set -x" to the beginning of your shell script, which should product a shell script trace that is often useful.
0c4
Posts: 5
Joined: Fri Sep 29, 2017 3:51 pm

Re: Problem with Put Statement Longer than 72 characters

Post by 0c4 »

Thank you. That is good to know. Personally I have been trying to shy away from using the shell scripts and providing the commands directly to COZBATCH. I dont know if it recommended or supported, but i have yet to run into an issue doing it in this fashion that the scripts got me around. The only thing was a heredoc is required if you have to use a line continuation. To me it appears more straight forward, but i do not have a shell scripting background.

Code: Select all

//*-------------------------------------------------------------------
//* COZPUT -  put a file using Coz SFTP.                           
//*-------------------------------------------------------------------
//COZPUT   EXEC PGM=COZBATCH,REGION=0M                                
//SYSTSPRT DD  SYSOUT=*                                               
//SYSOUT   DD  SYSOUT=*                                               
//STDIN    DD DSN=WM.Q2.COZ.PARMLIB(SFTPENV),DISP=SHR                 
//         DD DDNAME=BATCHIN                                          
//BATCHIN  DD DATA,DLM='²Ó'                                           
-P 2200 ccoody@sp04ftp                                                
ls /+mode=text,lrecl=80,recfm=fb,space=cyl.1.5                        
-rm //CCOODY.TEST.FILE                                                
-put //CCOODY.SP.PARMLIB.V1(DONKEY) //CCOODY.TEST.FILE                   
quit                                                                  
                                                                      
²Ó                                                                    
/*                                                                    
where WM.Q2.COZ.PARMLIB(SFTPENV) contains modified cards from the SFTPIND member in the Samplib

Code: Select all

/usr/local/coz/bin/cozsftp -oConnectTimeout=60       \
-oServerAliveInterval=60                             \
-oNumberOfPasswordPrompts=1                          \
-oStrictHostKeyChecking=yes                          \
-b-                                                  \
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: Problem with Put Statement Longer than 72 characters

Post by dovetail »

COZBATCH just starts the z/OS Unix shell (/bin/sh), so your input is a shell script.

BTW: we have some sample PROCs and scripts for running Co:Z SFTP in batch that we recommend you try:
https://dovetail.com/docs/sftp/client.h ... batch_samp
Post Reply