Skip to content

Instantly share code, notes, and snippets.

@JohnArchieMckown
Last active August 29, 2015 14:09
Show Gist options
  • Save JohnArchieMckown/4aae3e816d9094296519 to your computer and use it in GitHub Desktop.
Save JohnArchieMckown/4aae3e816d9094296519 to your computer and use it in GitHub Desktop.
Just some z/OS UNIX tricks using Dovetailed Technologies Co:Z product

Short vignettes using Co:Z from Dovetailed Technologies

Submit a job from a shell script.

todsn //intrdr <<EOF
//JOBNAME JOB ACCT,NAME,CLASS=A,MSGCLASS=B
//BR14 EXEC PGM=IEFBR14
//
EOF

Submit and monitor a job from a shell script

​set -o pipecurrent   # rqd for | read
# set some new JES symbols
jessym -c DSN1=MY.FOO.IN <http://my.foo.in/> DSN2=MY.FOO.OUT
# submit a job, passing all JES symbols, and get the jobid
todsn -x "symlist(*)" //intrdr | read x jobid <<EOF
//${LOGNAME}A JOB (),'Kirk'
...
//
EOF
echo "JOB $jobid submitted"

# wait a bit for the job to run
i=0
while [[ i -lt 20 ]]; do
  lsjes -t -i $jobid | read x jobname x phase x compl
  # lsjes outputs a line like:
  #    JOBnnnn JOBNAME USERID PHASE CLASS RC=XXXX
  if [[ "$phase" == "OUTPUT" ]]; then
    echo "JOB $jobname($jobid) completed $compl"
    # grab one of the job's spool files and print it to stdout
    # or maybe your want to use awk/grep/sed to process it?
    fromdsn -JES.$jobid.JESJCL
    break
  fi
  let i=i+1
  sleep 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment