Couldn't get handle: Failure

Discussion of the COZBATCH utility for z/OS
Post Reply
tombuch
Posts: 14
Joined: Tue Aug 10, 2010 7:02 am

Couldn't get handle: Failure

Post by tombuch »

I am using the CO:Z FTP server on MVS... I am trying to put to a dataset on the MVS server from an MVS CO:Z client batch job... The dataset that I am trying to put to has the following attributes:

Organization . . . : PS
Record format . . . : FB
Record length . . . : 0
Block size . . . . : 0
1st extent megabytes: 20

I realize that these are bad attributes... But when I try the transfer, I get the following on the clients error log:

cozsftp> put //DD:DOWNLOAD //D.SYP.TABAUDIT.RETURN.BACK
Uploading //DD:DOWNLOAD to //D.SYP.TABAUDIT.RETURN.BACK
ZosDatasetÝI¨: Opening dataset DD:DOWNLOAD for read
Ý33.969¨ Couldn't get handle: Failure
ZosDatasetÝI¨: Closing dataset //DD:DOWNLOAD - 0 records read, 0 bytes sent
debug2: channel 0: read<=0 rfd 4 len 0

On the server side the log shows:

debug1: subsystem: exec() /u/coz/bin/sftp-server.sh
debug2: fd 14 setting O_NONBLOCK
debug2: fd 13 setting O_NONBLOCK
debug3: channel 0: close_fds r -1 w -1 e -1
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: read<=0 rfd 14 len 0
debug2: channel 0: read failed
debug2: channel 0: close_read
debug2: channel 0: input open -> drain
debug1: Received SIGCHLD.
debug2: channel 0: ibuf empty
debug2: channel 0: send eof
debug2: channel 0: input drain -> closed
debug2: notify_done: reading

I resolved the problem by deleting the bad dataset on the server...

But, my question is: Why aren't there better messages to describe the problem?

Tom Buchwalter
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

The server side log messages (debug1, etc) are coming from the OpenSSH part of Co:Z sftp-server. Depending on how you have your logging configured, you are probably getting these from syslogd on your server.

For Co:Z sftp server, the z/OS specific logging goes to a per-session logfile, which by default is /tmp/sftp-server.<userid>.<dd.tttt>.log

If you look at this log file, you find more information about the failure.
Also, for convenience, the remote sftp client can download the logfile for the current session by doing:

Code: Select all

get /+error.log
Many people have asked why the client doesn't automatically see all of the error messages, and instead only "invalid handle". This is because the SFTP packet protocol doesn't allow for arbitrary messages, only a small set of error codes.

PS> You can also direct the OpenSSH debug messages to this log file by setting this in your profile:

Code: Select all

export SFTP_SERVER_OPTIONS="-e"
This will cause the OpenSSH debug messages to be merged into the Co:Z session log file, and not go to syslogd.
tombuch
Posts: 14
Joined: Tue Aug 10, 2010 7:02 am

Post by tombuch »

I did code the following:

$coz_bin/cozsftp $ssh_opts -b- tab@172.17.80.8 <<EOB
lzopts mode=text
put //DD:DOWNLOAD //D.SYP.TABAUDIT.RETURN.BACK
get /+/error.log
!cat error.log
EOB

But I did not get anything back....
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

This is probably because your "put" command failed, and since you are running the sftp client in batch mode this will terminate without processing any more subcommands.

If you prefix the "put" command with a dash ("-put"), then the command will continue even if the put command fails.
tombuch
Posts: 14
Joined: Tue Aug 10, 2010 7:02 am

Post by tombuch »

The '-put' helped....

Thank you
Post Reply