JCL & Unix Files
Part Two - Challenge #12


You will learn how to copy data to a Unix file using JCL

Many techniques are available to copy data between z/OS data sets and Unix file names.

The challenge uses JCL to execute Unix shell commands and execute a standard z/OS system utility to copy data from a partitioned data set member name to a Unix file name.

Information About Copying Data between Unix Files and z/OS Data Sets

Common ways to copy data between Unix file names and z/OS data sets:

  • Using JCL to execute standard utilities
  • Using Unix shell cp command
  • Using TSO ocopy, oput, oget, oputx, and ogetx commands
  • Using ISPF panels
  • Using ISPF editor


Modify and submit JCL to copy a PDS member name to a Unix file name

Important Details:

  •   Reminder - substitute your ID for Z##### and z#####
  •   Copy input is data set name Z#####.PDS.DATA member name MIX
  •   Copy output is Unix path and file name /z/z#####/mix
  •   Program IEBGENER DDNAME SYSUT1 is input
  •   Program IEBGENER DDNAME SYSUT2 is output
  •   JCL DD PATH= is used to reference Unix file name
  •   What follows PATH= must be enclosed in single quote marks
       A comma is needed after the path name to continue the DD statement
  •   The Unix file path and file name is lowercase
  •   Program BPXBATCH DDNAME STDOUT is the Unix command output
  •   JCL RESULT stepname, DDNAME STDOUT, needs to write output to &SYSUID..P2.OUTPUT(#12)
  1. Edit Z#####.JCL member name CH12JCL
    Modify JCL to copy data to a Unix file name, then execute Unix word count command,
    ' wc ' proving data was successfully copied
    • Change line 000013 where SYSUT2 is output of the data copy
    • Change line 000017 where STDOUT is output of the word count command
      proving data was successfully copied into Unix file name
  2. Submit modified JCL to copy data and verify successful copy
  3. Check output for successful copy

NOTE: The first time running CH12JCL, the DELETE step finish with a return code of 256 as a result of attempting to remove filename mix when mix filename does not exist. Return code 256 is the expected return code. All is ok.

Successful completion includes member name #12 in P2.OUTPUT with word count output

Your z/OS experience has grown another notch. NEXT!

Next: Challenge #13