Using sysout2pdf

This topic shows how to extend existing JCL that generates a batch report to use sysout2pdf.

Suppose you already have some JCL that generates a batch report. Now you want to use sysout2pdf to send you the report as a PDF using email. You need to make the following two changes to your JCL:

  1. Replace the parameters of the DD statement for the report data set with parameters that direct the report to a z/OS UNIX file.
  2. Append a BPXBATCH job step that calls the sysout2pdf z/OS UNIX shell script.
  1. Specify the following DD statement for the batch report:
     //WAIT0001 DD  PATH='/u/myhome/temp/wait analysis.txt', 
     //             PATHOPTS=(OWRONLY,OCREAT,OTRUNC),FILEDATA=TEXT,
     //             PATHMODE=(SIRUSR,SIWUSR,SIRGRP,SIROTH)

    The PATH parameter must refer to a z/OS UNIX directory that exists, and that you are permitted to write to.

    The PATHOPTS parameter specifies the access and status options for the file specified on the PATH operand. If the file exists, it will be overwritten. If it does not exist it one will be created. The file will be opened for writing.

    The FILEDATA parameter specifies that the data is to be treated as text.

    The PATHMODE parameter specifies the file permissions: in this example, the file owner has read and write permission; other users have read permission only.

  2. Append the following job step:
    //BPXBATCH EXEC PGM=BPXBATCH,REGION=0M
    //STDENV DD *           
    FOP_HOME=/usr/local/fop 
    /*
    //STDPARM DD *
    sh /usr/local/sysout2pdf/sysout2pdf
    -mailto username@example.com
    -subject "CICS PA: Wait Analysis"
    -body "PDF attached"
    -from "CICS PA"
    -mailin
    -rmin
    -rmpdf
    -filter cpa-wait
    "/u/myhome/temp/wait analysis.txt"
    /*
    //STDOUT  DD SYSOUT=*
    //STDERR  DD SYSOUT=*

The last argument that you supply to the shell script (in the STDPARM DD statement) must match the z/OS UNIX file path that you specified in the DD statement for the batch report. (Notice that STDPARM allows you to split the command-line arguments across multiple lines.)

The path following the sh command refers to the location of the sysout2pdf shell script.

The example above sends an email containing both the PDF and (as instructed by the -mailin option) the original plain-text input file (the batch report), and then removes both the input file and the generated PDF file (as instructed by the -rmin and -rmpdf options). The PDF contains bookmarks defined by the filter file cpa-wait (in the filters directory next to the sysout2pdf shell script). You might prefer not to send the PDF using email, and instead open it directly in a PDF reader application on your PC (say, via an SMB connection to z/OS UNIX).