Transferring files via FTP to z/OS seems to cause quite a bit of trouble with new Millennial Mainframers. This is partly because it’s not very intuitive sending and receiving files from the mainframe. Fortunately, there are a few ways to FTP.

One of the easiest ways is using IBM’s Personal Communications (or PCOMM). PCOMM is a 3270 terminal emulator, which is a client-side application that many mainframers use to communicate with the host. In some ways, PCOMM is a software implementation of the Ninjutsu (忍術) technique Hensōjutsu (変装術), which involved disguise, impersonation, and infiltration. From the perspective of the mainframe, z/OS thinks that it’s communicating with a traditional 3270 “green screen” terminal. However, in reality, the mainframe is really communicating with a Macbook Air or Microsoft Surface in disguise.

One of the great things about PCOMM is that is has FTP functionality built right into it. That’s right! PCOMM’s got additional Ninjutsu (忍術) powers!

In this case, PCOMM uses a host file-transfer program called IND$FILE to practice a technique of file transfer resembling Shurikenjutsu (手裏剣術). However, instead of throwing deadly weapons at the heart of your enemies, IND$FILE throws your choice of files into the heart of the z/OS filesystem!

If you’d like to learn more about the secretive art of IND$FILE, check out this great document from GSF Software.

For more general information about PCOMM, go here.

Send File to Host Example

Let’s go ahead and send a file to the mainframe. In this case, we’re going to send up a snapshot of the Earth taken by an Astronaut on the Apollo 17 mission. Since the System/360 mainframe was a key technology used by NASA to send men to the moon, this is pretty appropriate!

To follow along, grab this photo from Wikipedia here:

To start the transfer,  go to the “ISPF Command Shell” (Option 6 from the ISPF Primary Option Menu). Once on the panel, make sure that the cursor is on the beginning of the command line.

Then click on Actions -> Send File to Host…

This will open up Send Files to Host dialog.

Click on the ‘Browse…’ to select the Earth photo from your PC.

You’ll notice by default that the dialog automatically generates a Host File Name based on the file name appended with “bin” to signify that this is a binary file.  However, this will not work, as “The_Earth_seen_from_Apollo_17.jpgbin” does not follow z/OS dataset naming conventions.

According to convention, a z/OS dataset (file) is uniquely identified by a series of strings between one and eight characters, each separated by the dot (“.”) operator.  In the mainframe world, these names are each called “level qualifiers.” The leftmost or beginning string is called the dataset’s “high-level qualifier.” The subsequent middle strings are called “middle-level” qualifiers. The rightmost or last string is called the dataset’s “low-level qualifier”.

For example, in the z/OS dataset PAULY01.WORK.CLIBS:

  • PAULY01 is the High-Level Qualifier
  • WORK is a Middle-Level Qualifier
  • CLIBS is the Low-Level Qualifier
Oftentimes, the high-level qualifier is shared between numerous datasets to act as a form of organization similar to a directory.  The low-level qualified is often used to show the type of data stored in the dataset, similar to a file extension.

To correct this naming issue, rename the photo to ‘[USERID].EARTH,’ where USERID is your current z/OS user ID. I also make sure that “binary” is selected in the Transfer Type drop-down box, since with is binary file (.jpg) and not a text file.

It is critical to select “binary” because z/OS uses EBCDIC for character encoding, which is different from the ASCII scheme used by other platforms. Selecting “text” in the Transfer Type drop-down box causes the file to be translated between the two schemes to ensure the that text is readable by mainframe tools such as ISPF Editor. If you select this for your image, the binary data in the jpg photo of the Earth will become scrambled and unreadable.

Once the dialog is filled out, click “Update in List” to update the transfer file changes.

Finally, click “Send” to initiate the transfer.  The pop-up window will disappear when the transfer is complete.

Let’s check to make sure that our photo actually made it into z/OS. Go back to the “ISPF Primary Option Menu” and select option “3 Utilities” and “4 Dslist” to enter the DSList utility.  Once in DSList, enter [USERID].EARTH in the panel and hit execute. We now can see our file in z/OS.

We can go ahead an browse the dataset, but we’ll only see the JPG binary data associated with the Apollo 17 snapshot of Earth. Since z/OS doesn’t have a GUI like Windows, Linux, or Mac OS X, there is no direct way to view the photo directly.

FTP with Windows’ FTP.exe

Now that we’ve uploaded the binary data of “Earth.jpg” to z/OS dataset named [USERID].EARTH, let’s go ahead and download the file back to our PC using the Microsoft FTP Utility so that we can make sure that the picture is intact.
To do this, open up a DOS prompt (Start > Run > cmd) and enter ftp to start ftp.exe

Then enter the ftp command “open” followed by the IP address or DNS name of your mainframe.

If you don’t know this, then you’ll have to talk with your network admin to find out the IP or DNS name (or if it’s even activated).

In this example, we connected to host at “server.ca”

After connecting to the mainframe, enter your login userid (BBBBBPG) and password.

Notice that upon connecting, your “working directory” is set to BBBBBPG. This “working directory” is really the High-Level Qualifier of the datasets in the filesystem. Since a common z/OS convention is to set the high level qualifier of datasets to the USERID that owns the dataset, this is logical.

Similar to when we uploaded the photo, change the transfer type to “binary” by entering the FTP command ‘bin’

Finally, receive the file from the host by issuing ‘get earth’

Notice the message ‘Sending data set BBBBBPG.EARTH.’

At this point, the transfer is successful. The file is now on our local hard drive. However, the High-Level Qualifier of the file has been stripped off, so the file is called “earth” without a file extension.

To help your operating system understand that this file contains picture data, rename the file to add the “.jpg” file extension in the DOS prompt with the command “rename oldfile newfile.jpg”

Now, we can open the file and automatically using a photo viewer.  Success!  The entire Earth is there.

From coast to coast and continent to continent, you are now the Mainframe Ninja!

Paul Gamble
Graduate of Georgian College, Computer Programmer Analyst program

After doing a four month internship with the Canadian Government, Paul was offered the rare opportunity to work in their on-site Data Centre. Starting out as an Operator for four years before becoming a Systems Programmer rolling out different independent software vendors (ISVs) and different IBM Tivoli products for monitoring and automation to the z/OS platform. Paul enjoys the constant learning the z/OS operating system offers in comparison to other platforms. On weekends you’ll find Paul getting his adrenalin fix by instructing and coaching at the local skydiving drop-zone.
Connect with Paul on LinkedIn