On IBM zOS using a DATASET file system, the FILE command always returns with an empty list
An IBM server described by the library as follows 220-FTPD1 IBM FTP CS V2R3 at XXXXXXXXXXXXX, 16:48:12 on 2021-02-11. Response: 220 Connection will close if idle for more than 5 minutes. Status: Detected FTP server: IBMzOSFTP .... MVS is the operating system of this server. FTP Server is running on z/OS.
When I try to list the contents of a directory I always get an empty list, see the library log for more details:
# Connect()
Status: Connecting to 10.1.2.83:21
Response: 220-FTPD1 IBM FTP CS V2R3 at XXX.XXXX.COM, 17:41:19 on 2021-02-11.
Response: 220 Connection will close if idle for more than 5 minutes.
Status: Detected FTP server: IBMzOSFTP
Command: USER DEVCDP
Response: 331 Send password please.
Command: PASS ***
Response: 230 DEVCDP is logged on. Working directory is "DEVCDP.".
Command: FEAT
Response: 211- Extensions supported
Response: AUTH TLS
Response: PBSZ
Response: PROT
Response: 211 End
Status: Text encoding: System.Text.ASCIIEncoding
Command: SYST
Response: 215 MVS is the operating system of this server. FTP Server is running on z/OS.
Command: LIST ['DEVCDP.*']
Response: 550 No data sets found.
Command: CWD 'DEVCDP.'
Response: 250 "DEVCDP." is the working directory name prefix.
Command: PWD
Response: 257 "'DEVCDP.'" is working directory.
# GetWorkingDirectory()
Command: PWD
Response: 257 "'DEVCDP.'" is working directory.
# GetListing("", SizeModify)
# GetWorkingDirectory()
Command: PWD
Response: 257 "'DEVCDP.'" is working directory.
Command: TYPE I
Response: 200 Representation type is Image
# OpenActiveDataStream(AutoActive, "LIST 'DEVCDP.'", 0)
Command: EPRT |1|10.1.3.181|52927|
Response: 200 EPRT request OK
Command: LIST 'DEVCDP.'
Response: 550 No data sets found.
# Connect()
Status: Connecting to X.X.X.X:21
Response: 220-FTPD1 IBM FTP CS V2R3 at XXX.XXXX.COM, 17:41:19 on 2021-02-11.
Response: 220 Connection will close if idle for more than 5 minutes.
Status: Detected FTP server: IBMzOSFTP
Command: USER DEVCDP
Response: 331 Send password please.
Command: PASS ***
Response: 230 DEVCDP is logged on. Working directory is "DEVCDP.".
Command: FEAT
Response: 211- Extensions supported
Response: AUTH TLS
Response: PBSZ
Response: PROT
Response: 211 End
Status: Text encoding: System.Text.ASCIIEncoding
Command: SYST
Response: 215 MVS is the operating system of this server. FTP Server is running on z/OS.
Command: LIST ['DEVCDP.*']
Response: 550 No data sets found.
Command: CWD 'DEVCDP.'
Response: 250 "DEVCDP." is the working directory name prefix.
Command: PWD
Response: 257 "'DEVCDP.'" is working directory.
# GetWorkingDirectory()
Command: PWD
Response: 257 "'DEVCDP.'" is working directory.
# GetListing("", SizeModify)
# GetWorkingDirectory()
Command: PWD
Response: 257 "'DEVCDP.'" is working directory.
Command: TYPE I
Response: 200 Representation type is Image
# OpenActiveDataStream(AutoActive, "LIST 'DEVCDP.'", 0)
Command: EPRT |1|10.1.3.181|52927|
Response: 200 EPRT request OK
Command: LIST 'DEVCDP.'
**Response: 550 No data sets found.**
Can you try with filezilla, and if it works, post its logs so we can compare?

The log itself is not very revealing. Copied from the above session is just this: Status: TLS connection established. Status: Server does not support non-ASCII characters. Status: Logged in Status: Retrieving directory listing... Status: Directory listing of "['DEVCDP.']" successful Status: Retrieving directory listing of "['DEVCDP.']"... Command: PASV Response: 227 Entering Passive Mode (10,1,2,83,57,251) Command: LIST Response: 125 List started OK Response: 250 List completed successfully. Status: Directory listing of "['DEVCDP.']" successful
As you can see in the image capture FileZilla does show the files correctly so it must be getting something out of the LIST command.
These old IBM/MVS servers always give trouble with listing. I'm not entirely sure why. Try changing client.DataConnectionType to passive or to another type and see if it works.
I have tried all the connection types (AutoPassive, PASV, PASVEX, EPSV, AutoActive, PORT and EPRT) and they all behave the exact same way. It is also worth mentioning that it behaves the same way with a regular unprotected FTP (non-TLS)
I have source for an FTP client that was developed in-house and it works fine for the listing command. I will step through the in-house solution and figure out where the magic sauce is and add that to your project. I'll file a Pull request to incorporate it in your library.
Let me know if you'd like to join me for a screen share session where I walk through the working client, maybe you can spot where the key to make it work is.
Please reach me at carlos.diaz.perez at gmail.com and we can setup a screen share session.
I found what the problem is...on an IBM/MVS Ftp server the LIST command with arguments just doesn't work, but it does without arguments, and it will return the current directory listing. If my ftp client only asks for listings in this fashion I can get around the issue as long as I use the flag FtpListOption.NoPath when I call the GetListing method without a path. Without this flag, there is a line of code that will add the current path to the LIST command when the input path is empty and will cause it to fail (FtpClient_Listings.cs, line 484) I'm not sure this is worthy of a code change and make a special case for IBM/MVS servers....What do you think?
I will step through the in-house solution and figure out where the magic sauce is and add that to your project. I'll file a Pull request to incorporate it in your library.
This sounds great and is always welcome.
Let me know if you'd like to join me for a screen share session where I walk through the working client, maybe you can spot where the key to make it work is.
I'm sorry I don't provide such services.
I'm not sure this is worthy of a code change and make a special case for IBM/MVS servers....What do you think?
It is not an issue, we can support these. Some questions:
-
Will this fix work for ALL IBM/MVS servers and is there any way we can automatically use this behavior (version number string, or the welcome message, etc), as that would be preferable and that's how I like to enable server-specific behaviour (automatically and silently in the background, so it "just works" for other users as well)
-
If not, what can of handling do you need to support this use case - only that LIST command should not be sent with any arguments if I understand correctly?
-
Are you able to workaround right now and what is preventing you? Is it crashing?
I have this problem as well. I will verify that it fails on the newest version of zOS.
I tried using FtpListOption.NoPath , but got nothing in the returned collection. I then used FtpListOption.NoPath Or FtpListOption.ForceNameList and that worked.
These old IBM/MVS servers always give trouble with listing. I'm not entirely sure why.
Not old. Actually very current. And some of the features of the IBM Communication Server TCP/IP stack are quite bleeding edge.
The IBM CS is available on a number of platforms. z/OS, AIX, AS/400, Windows and z/Linux.
You may want to refer to: this
On each of these platforms, the list formats might differ slightly (more so on z/OS).
I have been looking at the current code and can see that the FTP greeting message used for server recognition is from z/OS V2R3. But the list parser refers to handling the IBM CS AS/400 format. That in itself is slightly worrying.
I have forked FluentFTP and will try to get listing in FTP to CS z/OS working a little bit better.
Basically, prior to a LIST, it is useful to use a PWD to determine the file realm you are in: Are you in the USS (Unix System Services) realm, the path would be like "/....." unix like. Or are you in the native z/OS realm where the names look like "qualifier.qualifier....[(member)]" (where the
Since LIST when used with NoPath always lists the top level, the strategy is to "CWD" (change working directory) to the first qualifier (the so called "HLQ" (high level qualifier)) and the LIST from that location.
In the USS realm, things are less nasty.
So the entire logic of how to obtain a LIST depends on a few things that need to done beforehand.
Trouble is, with the current FluentFTP code, it would mean server specific changes/additions in some places, It's not just the listing parser that needs enhancing.
It is useful to telnet into the z/OS server (just don't try a list or anything that needs a data connection), this will give a view into the ftp server that is not masked by any command quirks of the ftp client:
geek@file:~# telnet deve 21
Trying 192.168.3.3...
Connected to ######.########.eu.
Escape character is '^]'.
220-FTPD1 IBM FTP CS V2R4 at ######.########.eu, 11:24:57 on 2021-10-08.
220 Connection will close if idle for more than 5 minutes.
user GEEK
331 Send password please.
pass #######
230 ##### is logged on. Working directory is "GEEK.".
help
214-The server-FTP commands are:
214-ABOR,*ACCT,*ALLO, APPE, CDUP, CWD, DELE, FEAT, HELP, LANG, LIST, MDTM, MKD
214-MODE, NLST, NOOP, OPTS, PASS, PASV, PORT, PWD, QUIT, REIN, REST, RETR, RMD
214-RNFR, RNTO, SITE, SIZE, *SMNT, SYST, STAT, STOR, STOU, STRU, TYPE, USER
214-ADAT, AUTH, CCC, PBSZ, PROT, EPSV, EPRT
214-The commands preceded by '*' are not implemented
214-The data representation type may be ASCII, EBCDIC or IMAGE, or may be
214-one of the following Double Byte Character Sets:
214-EBCDIC IBM Kanji, Shift JIS Kanji, Extended Unix Code Kanji,
214-JIS 1983 Kanji, JIS 1978 Kanji, Hangeul, Traditional Chinese,
214-or Korean Standard Code KSC-5601, 1989 Version
214-The data structure may be File or Record.
214-The mode may be Stream, Block, or Compressed.
214-If the connection to this server is inactive for more than
214-300 seconds, the connection will be closed.
214-Data set names are represented as either a valid MVS data set name
214-or a valid HFS file name.
214-For information about a particular command, type
214 HELP SERVER command or QUOTE HELP command
feat
211 no Extensions supported
cwd /projects
250 HFS directory /projects is the current working directory
pwd
257 "/projects" is the HFS working directory.
cwd 'SYS1'
250 "SYS1." is the working directory name prefix.
pwd
257 "'SYS1.'" is working directory.
You can see the two realms: paths with a slash ("/") and "paths of a sort" with names beginning with xxxxxxx
pwd
257 "'GEEK.'" is working directory.
cwd CT.DEVE
250 "GEEK.CT.DEVE." is the working directory name prefix.
cwd ..
250 "GEEK.CT." is the working directory name prefix.
cwd ..
250 "GEEK." is the working directory name prefix.
cwd ..
250 "" is the working directory name prefix.
Note: The topmost level (an empty working directory) cannot be "listed". There is no easy way inside this FTP realm to get a list of all possible high level qualifiers. When you log on to the FTP server (in this example as "GEEK", your HLQ and thus the current working directory will be "GEEK." (note the period).
Those who want to access an IBM CS AS/400, this is a very different animal. I suggest looking at this to get an inkling. Using a path with a slash (or programatically issuing a NAMEFMT command) makes the names "unix-like", and I would assume that the FluentFtp library works. Looks like the "IBM" server detection is really more exactly a AS/400 and not z/OS, could that be?
I have placed an initial PR which I myself am using now.
Could you close this, please. It's no longer open, by a long time
Close please !!!