WinSCP and z/OS FTP Server

Advertisement

gustav_heinrich
Guest

WinSCP and z/OS FTP Server

Hi all,

WinSCP is our company's (semi-)official FTP client of choice. As a member of the mainframe department, I connect to FTP servers running on IBM's z/OS most of the time.

All works well when using WinSCP in the interactive GUI-based mode. However, when trying to automate file transfers using WinSCP's batch interface, things turn out to be a little complicated.
While uploading files to the mainframe still works as expected, scripted downloads are restricted. It seems as if the main problem is that, before issuing the actual RETR command, WinSCP sends a LIST command to the server. Apparently, it then attempts to find the name of the file to be downloaded within the received listing. This works as long as one does not specify a fully qualified z/OS dataset name (that is, a dataset name enclosed within single quotes) in the GET batch statement. Trying to do so makes the operations fail with error messages of the type

Can't get attributes of file ''HLQ.DATASET.NAME''    

On plain z/OS, there is basically no such concept as directories in terms of hierarchically organized folders which one can specify paths to. Rather, z/OS dataset names consist of multiple qualifiers all separated by periods. To account for this, on an FTP server running on z/OS, the CWD command does not actually change into the specified directory, but rather sets a certain dataset name prefix. In GET or PUT operations, in case they do not use a fully qualified dataset name, this dataset name prefix is prepended to the involved dataset names. For LIST commands, only datasets with a name matching this prefix are returned. (As a side note and reflecting on this for a moment, one comes to the conclusion that, in the context of an FTP server, this behavior is actually not that far from and somewhat compatible to the concept of directories.)

Now, since after login the dataset name prefix is set to the name of the current user, the LIST command issued at the beginning of a GET operation returns only those datasets which are under the HLQ of the user. In the interactive GUI-based mode, this is not a problem, since using the GUI the user is unlikely to specify a fully qualified dataset name, but will rather either download a dataset under his/her HLQ or CWD to the appropriate prefix before starting a download operation.
In both cases, WinSCP will find the requested dataset name in the listing returned by the LIST command.

In batch mode, however, one can specify a fully qualified dataset name as described above. Apparently, WinSCP issues a LIST rather than a LIST 'HLQ.DATASET.NAME' command in this case. Consequently, the received listing will contain only those datasets matching the current dataset name prefix (i.e. the name of the current user) and not the requested one.

As a workaround, one can manually add an appropriate CD command and then use the dataset name without the specified prefix in the subsequent GET operation. Apparently, this is also what WinSCP does automatically when specifying a fully qualified UNIX-style filename (i.e. one starting with "/").
Manually splitting the operations like this, however, makes things unnecessarily complicated.


Based on this, I would like to ask whether it is somehow possible to make WinSCP identify fully qualified z/OS dataset names by means of the leading ' and then craft and issue the appropriate CD commands.


Thanks in advance!

Regards,
gustav_heinrich

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: WinSCP and z/OS FTP Server

Thanks for your detailed post. Can you include few log files illustrating the various scenarios?

Reply with quote

gustav_heinrich
Guest

Hi Martin,

we have run five tests and included the server and client logs as well as the scripts that were used (see the attached archive).

-) get_mvs__abs_no_cd.txt: FTP GET on an MVS dataset. The name of this dataset was specified as a fully qualified name.
-) get_mvs__rel_cd.txt: FTP GET on an MVS dataset. The name was specified as a "relative" dataset name. An apropriate preceding CD command was added.
-) get_mvs__rel_no_cd.txt: FTP GET on an MVS dataset. The name was specified as a "relative" dataset name. NO preceding CD command was coded.
-) get_uss__abs_no_cd.txt: FTP GET on an Unix dataset. The name was specified as a fully qualified path. NO preceding CD command was coded.
-) get_uss__rel_cd.txt FTP GET on an Unix dataset. The name was specified as a relative path. An appropriate preceding CD command was added.


Regards,
gustav_heinrich
  • logs.zip (20.7 KB, Private file)
Description: The passphrase is *W1nSCP*

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Thanks. It may take few days, before I'll be able to dig into this. I'll get back to you.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Can you do RETR 'OTHERHLQ.FTPTEST.TXT' on the MVS FTP server?

Reply with quote

gustav_heinrich
Guest

Yes, this is possible. The MVS FTP server will then send the dataset with name OTHERHLQ.FTPTEST.TXT and will not prepend the current dataset name prefix. Specifying a name enclosed in single quotes on an MVS FTP server is somewhat similar to specifying the name with a leading slash on a UNIX-style server.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: WinSCP and z/OS FTP Server

This issue has been added to the tracker:
https://winscp.net/tracker/show_bug.cgi?id=1579

Thanks for your report.

Can you send me an email, so I can send you back a development version of WinSCP for testing? Please include link back to this topic in your email. Also note in this topic that you have sent the email. Thanks.

You will find my address (if you log in) in my forum profile.

Reply with quote

Advertisement

You can post new topics in this forum