Unix System Services Fun and Facts
Part Two - Challenge #13


You will learn how to use JCL for Unix shell processing, then edit a Unix file

z/OS is both flexible and open as a result of a tightly integrated Unix Systems Services component in the z/OS Base Control Program.

The challenge involves using JCL to execute Unix shell commands, reviewing the output, and then editing a Unix file created by a Unix shell command processing.

Information about the Challenge JCL JOB Used to Process Unix Shell Commands

Description of JCL JOB CH13JCL

  • PGM=BPXBATCH provides a Unix environment for shell command processing or program execution
  • STDPARM is the DDNAME BPXBATCH uses to read input
  • sh is the first control statement requesting BPXBATCH to start a Unix shell
      Alternatively, pgm can be coded to execute a Unix program instead of a Unix shell commands
  • The semicolon ' ; ' at the end of each line means the next line is new input to sh Unix shell
  • Line 17 executes Unix calendar cal command and writes ' > ' output to Unix file name sept1752
      Unix cal command writes calendar information
  • Line 23 executes Unix ls -al command and writes output to Unix standard output STDOUT DDNAME
      Unix ls -al command writes a list of file names
  • Line 29 executes Unix uname -a command and writes output to Unix standard output STDOUT DDNAME
      Unix uname -a command writes the Unix name
  • Line 35 executes Unix manual page man command
      Unix man command writes information from the Unix manual pages
      -- Unix manual page information about copy cp command is written to STDOUT
      -- The written output is passed as input to a pipe which the vertical bar ' | '
      -- Output of the pipe is input to Unix grep command
      -- grep // will output only lines containing ' // '
      -- // syntax can be used in Unix System Services cp command to reference data set names
      -- The resulting lines from man cp show syntax examples of copying data between Unix file names
        and data set names


Submit JCL, Review Output, and Edit Unix File
  1. View or Edit JCL(CH13JCL)
      Observe output Unix calendar cal command will be written to a Unix file name
  2. Submit JCL
  3. Review CH13JCL output for successful completion
  4. Enter tso omvs on any ISPF command line
      You are now in Unix System Services Shell prompt in your home directory
  5. Enter oedit sept1752 from the Unix shell prompt
      Observe 11 days are missing
  6. On line 8 starting in column 1, enter the year in which the "Gregorian" calendar was first introduced
      The year can found in Explanation for the 11 missing days
  7. Type ISPF editor primary command replace p2.output(#13) and c99 on line 000001, then enter to copy all lines to member #13 in data set p2.output.   Result should be output written to P2.OUTPUT(#13)
      ISPF line command c99 copies 99 lines which copies all the lines because number of lines is less than 99

NOTE: Ignore message "Data set attributes are inconsistent. Truncation may result.."
Enter to proceed past message

F3 to exit oedit session

exit to terminate unix shell session

enter to return to ISPF session

Successful completion includes member name #13 in P2.OUTPUT with September 1752 calendar followed by year the "Gregorian" calendar was introduced

You learned some trivia about the history of the calendar while learning basics of z/OS environment

Next: Challenge #14