cozsftp command issuing an Error Code 31

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
wm212333
Posts: 13
Joined: Thu Jul 23, 2009 11:02 am

cozsftp command issuing an Error Code 31

Post by wm212333 »

I receive an error code 31 from the cozsftp command. I am issuing the command from z/OS Unix. The sftp completes successfully. Also where can I find a list of cozsftp error codes?


/* REXX */
CMD='cozsftp -b /home/sftpbatb user@rmthost.j'
call bpxwunix CMD,,OUT.,ERR.
say 'RC=' ERR.0
/* End REXX */

RC = 31

sftpbatb
put '//fb.fromdsn' tofile
quit
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

CO:Z SFTP uses the same return codes as OpenSSH sftp, and AFAIK the only exit codes are 0, 1, 11, and 255. One possibility is that the exit code is coming from the ssh command (part of IBM ported tools), which is called by cozsftp.

But I don't believe that 31 is a code from either cozsftp or ssh; it seems more likely that it is an exit code from bpxwunix().

If you can run cozsftp with -vvv and export COZ_LOG=T, then log output should be written to stderr. If you route that to a file rather than capturing with bpxunix(), then you can see what errors you are getting. If you can't get the stderr output, then there is no way of determining what is going wrong.

If what you are trying to accomplish is to run cozsftp in batch, there is sample JCL shipped with CO:Z that demonstrates how to do this using a shell script, rather than bpxwunix.
wm212333
Posts: 13
Joined: Thu Jul 23, 2009 11:02 am

Post by wm212333 »

It does appear that the error code 31 is being generated by the bpxwunix command. The code below now issues the command w/o bpxwunix and it works! How do I capture the error code in a REXX variable in case a statement in sftpbatb is invalid? Example: If I change put to putq I will receive the following error message -


sftp putq '//fb.fromdsn' tofile
[00779] Invalid command.
+++ RC(1) +++


________________________________________________

/* REXX */
CMD='cozsftp -b /home/sftpbatb user@rmthost'
CMD
/* End REXX */

sftpbatb
putq '//fb.fromdsn' tofile
quit
Post Reply