COZ SFTP rc=exitcode problem

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
cagatayucuzal
Posts: 40
Joined: Thu Jun 01, 2017 9:15 am

COZ SFTP rc=exitcode problem

Post by cagatayucuzal »

Hello,
in our test enviroment, there are two problems,

1.if you don't give a script name cozbactc (sftp_put.sh,...)in the JOb, it ends rc=0, in our expect ends rc>4

2.it ends rc=1 when don' find file,our expect rc>4

cozsftp> put //XXXX.ISPxx test/test.txt
$89.585¨ stat //XXXX.ISPxx: not found
CoZBatch$I¨: returning rc=exitcode=1

Do you have any comments?
Regards
coz
Posts: 391
Joined: Fri Jul 30, 2004 5:29 pm

Re: COZ SFTP rc=exitcode problem

Post by coz »

1.) Your Unix System Services shell script is running without calling sftp_put.sh, but this is not an error. The shell script is exiting successfully, and returning the rc of the last operation, which is zero. So rc=0 (and job step CC of 0) is correct in this case.

2.) When SFTP succeeds, it issues an rc=0. If it fails, it always issues rc=1, no matter what the error is. If you would like to convert the rc=1 to a job step condition code > 4, you can modify your shell script by adding the following lines, immediately after your call to sftp_put.sh:

Code: Select all

. $script_dir/sftp_put.sh
test $? -ne 0 && exit 12 
exit 0
This will cause non-zero sftp return values to force the script to exit with rc=12, which in turn will set a job step CC of 12. Otherwise (if sftp succeeds) the script will exit with rc=0 (and set the job step CC to 0).
Post Reply