WavebreakMediaMicro - Fotolia

How do I transfer a PS file from a mainframe to a Linux server?

I need to transfer one PS file's data from a mainframe to a Linux server. Are there any JCL scripts that can do this for me?

There are several ways to migrate a PS file from a mainframe to a Linux server. The easiest is probably File Transfer Protocol (FTP). 

Here's a sample job control language (JCL) in the mainframe:

//FTPJOB    JOB  ACCT
//FTPSTEP   EXEC  PGM=FTP
//OUTPUT    DD  SYSOUT=*
//SYSPRINT  DD  SYSOUT=*
//SYSIN     DD  *
ftp.server.com
userid
password
cd /incoming
bin
put 'main.frame.file' mainframe.file

Create the JCL and stack up mainframe FTP responses in the SYSIN DD card -- the same as in an interactive session. Each response is case-sensitive and will not work with JCL sequence numbers in columns 73 through 80.  If you're editing in a Interactive System Productivity Facility, set the edit profile to use mixed case (caps off) and no sequence numbers (unnum).

There are three things to watch out for:

  1. You may need to include the mainframe data set name in quotes (as in the above example).
  2. Text files are automatically translated from EBCDIC to ASCII if you set the transfer mode to ASCII.  Otherwise, binary files should be transferred in bin mode (as shown above) to avoid changing data.
  3. Linux files don't have logical record lengths or block sizes. This is less of a problem for text files because IBM's FTP marks the end of each record with carriage return/line feed character combinations that Linux text editors understand. Binary files, on the other hand, will be byte streams on the server.

Also note that FTP requires a valid logon ID and password for the server. More sophisticated file transfer software, like IBM Sterling Connect:Direct, transfers files between platforms under the originator's security context without sending passwords over the network.

About the author:
Robert Crawford spent 29 years as a systems programmer, covering CICS technical support, Virtual Storage Access Method, IBM DB2, IBM IMS and other mainframe products. He programmed in Assembler, Rexx, C, C++, PL/1 and COBOL. Crawford is currently an operations architect based in south Texas, establishing mainframe strategy for a large insurance company.

Next Steps

Check out these related community questions and answers:

How do I convert FTP to secure FTP on the mainframe?

Sending a mainframe file to users in CSV format?

How can a mainframe data set convert into PDF format?

I want to compare PS file date with current date. Is there a JCL sort?

Dig Deeper on Data center hardware and strategy