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
cozsftp command issuing an Error Code 31
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.
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.
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
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