Problem using CZFTPCMD

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
giltjr
Posts: 26
Joined: Wed Jul 07, 2010 9:06 pm

Problem using CZFTPCMD

Post by giltjr »

We have FTCHKCMD working for standard FTP. What this exit does is it checks for specific file names and if we find a match it will append .Dmmddyy.Thhmmss to the end of the file name.

I am getting weird results when doing this with Co:Z SFTP.

The 1st time I send a file through it works, but the second time I send the file though it gets an error.

The command I issue is:

put source.txt //USERID.ENV.DATATYPE

I get back:

Uploading source.txt to //USERID.ENV.DATATYPE

The file name matches and so the file is created as:

USERID.EVN.DATATYPE.Dmmddyy.Thhmmss

The second time is try and tranfer that file I get back

Uploading source.txt to //USERID.ENV.DATATYPE/source.txt
remote open("//USERID.ENV.DATATYPE/source.txt"): Failure

In my sftp log I see:

IKJ56231I FILE SYS00007 NOT ALLOCATED, SYSTEM OR INSTALLATION ERROR+
IKJ56231I TEXT UNIT X'0002' CONTAINS INVALID LENGTH
DatasetHandler[E]: BPXWDYN allocation failed S99ERROR=0x037C S99INFO=0x0002
DatasetHandler[E]: BPXWDYN command was: "alloc fi(SYS00007) reuse msg(2) da('USERID.ENV.DATATYPE.SOURCE.TXT.D071810.T205005') new catalog"
ZosDataset[E]: Dataset USERID.ENV.DATATYPE.SOURCE.TXT.D071810.T205005 open error: EDC5000I NO ERROR OCCURRED. (errno2=0x0594003D)
ZosDataset[E]: last_op=604, error=0x0, msg=
IKJ56247I FILE SYS00007 NOT UNALLOCATED, IS NOT ALLOCATED

For some reason it is sticking the source file name in there. Now what is really weird (at least to me), is if I create the file USERID.ENV.DATATYPE I can send the file over and over again, and it gets the date/time stamp appended to it.
dovetail
Site Admin
Posts: 2025
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

What is happening is this:

The first time you put the dataset 'USERID.ENV.DATATYPE', it doesn't exist.

The second time you put the dataset 'USERID.ENV.DATATYPE', there is already a dataset 'USERID.EVN.DATATYPE.Dmmddyy.Thhmmss', so the name 'USERID.EVN.DATATYPE' is taken as a directory name, and the source file name 'source.txt' is uploaded into that directory.

see this appendix for full details:
http://dovetail.com/docs/sftp/dsn-determination.html

To avoid this problem (uploading to a dataset name that is also a pseudo directory name), try this:

put source.txt //!USERID.ENV.DATATYPE
giltjr
Posts: 26
Joined: Wed Jul 07, 2010 9:06 pm

Problem using CZFTPCMD

Post by giltjr »

Thanks, that solved that problem. I'm having another issue with a different exit, but I will open a new post for that.
Post Reply