How can Batch Processor be used to run DFSORT?

Document ID : KB000048280
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

The .CALL command can invoke any user application programs within a Batch Processor execution. You can pass a parameter list and input statements to the called program. Use the .ALLOC command to allocate all necessary data sets for the called application. DFSORT is an application program that can be called by the .CALL command within a batch processor DDL stream to carry out the functions that DFSORT provides without having to do the step in a separate JCL step.

Solution:

  1. The JCL needed is just the standard execution JCL generated by batch processor to execute in batch.

    Ensure that you have a .RESTART OVERRIDE so that the job can be resubmitted without any problems if it has to be restarted. You could also add the SORTDIAG DD to produce the diagnostic messages.

     //STEP1 EXEC PGM=PTLDRIVM,REGION=4M,PARM='EP=BPLBCTL'        //STEPLIB DD DISP=SHR,DSN=PTIPROD.CA.CDBALOAD  // DD DISP=SHR,DSN=SSID.PRIVATE.SDSNEXIT // DD DISP=SHR,DSN=DB2.DB2.SDSNLOAD //PTILIB DD DISP=SHR,DSN=PTIPROD.CA.CDBALOAD // DD DISP=SHR,DSN=SSID.PRIVATE.SDSNEXIT // DD DISP=SHR,DSN=DB2.DB2.SDSNLOAD //PTIPARM DD DISP=SHR,DSN=PTIPROD.CA.CDBAPARM //PTIXMSG DD DISP=SHR,DSN=PTIPROD.CA.CDBAXMSG //SYSOUT DD SYSOUT=* //PTIIMSG DD SYSOUT=* //SYSPRINT DD SYSOUT=* //UTPRINT DD SYSOUT=* //SORTDIAG DD SYSOUT=* //ABNLIGNR DD DUMMY SUPPRESS ABENDAID DUMPS //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(30,30)) //BPIIPT DD DISP=SHR, // DSN=your.batch.processor.code(member) //BPIOPT DD * .CONTROL BPID(your.batch.processor.code-member) + LOGID(SSID) UNIT(SYSDA) .OPTION NOERRORS NOSQLERRORS RETRY(01) NOBINDERRORS + WRAPLINE .RESTART OVERRIDE .CONNECT SSID

  2. The dataset above I have called your.batch.processor.code(member) will contain your DFSORT statements

    DFSORT allows you to pass commands to it via the SYSIN or the DFSPARM DD cards or in the .CALL statement itself.

    Below are examples of each that would be contained in your.batch.processor.code(member) in the above JCL.

    CA Batch Processor parms used in the .CALL statement

    The .CALL to SORT below in both samples uses the SYSLIB option. This specifies that a called program is available through a system search. If you specify the SYSLIB parameter, you do not have to allocate a USERLIB. So in this case I assume that the .CALL to SORT will find the DFSORT program in the system allocations.

    The ALLOC(NO) parm is used also. The ALLOC parm allocates a file for the INDDN or OUTDDN automatically. To override the allocation of SYSIN and SYSPRINT I used ALLOC(NO) and have entered my own dataset allocations for these.

    All SYSIN and DFSPARM datasets are allocated as FB lrec 80 sequential datasets.

    Examples:

    DFSPARM Used:

    .ALLOC FI(SORTIN)                                          +      DA(YOUR.SORTIN')                                     +      OLD.ALLOC FI(SORTOUT)                                         +      DA('YOUR.SORTOUT')                                   +      OLD.ALLOC FI(DFSPARM)                                         +      DA('YOUR.DFSPARM')                                   +      OLD.CALL SORT SYSLIB ALLOC(NO)

    In the code above there are allocate statements for the SORTIN and SORTOUT DD's and DFSPARM.

    All the parms for the above SORT operation are passed via the DFSPARM DD below. None from SYSIN or in the .CALL statement.

    The DFSPARM DD can contain parms like this:

    OPTION MSGPRT=CRITICAL ABEND LISTSORT FIELDS=COPY

    Note the above parms MUST start from column 2 of DFSPARM and a space must be in column one as this is a DFSORT requirement.

    The "SORT FIELDS=COPY" in this case does a COPY from SORTIN to SORTOUT DD.

    SYSIN and PARM Used:

    .ALLOC FI(SORTIN)                                           +      DA('YOUR.SORTIN')                                     +      OLD.ALLOC FI(SORTOUT)                                          +      DA('YOUR.SORTOUT')                                    +      OLD.ALLOC FI(SYSIN)                                            +      DA('YOUR.SYSIN')                                      +      OLD.CALL SORT PARM(MSGPRT=CRITICAL,ABEND,LIST) SYSLIB ALLOC(NO)

    In the code above there are allocate statements for the SORTIN and SORTOUT DD's and SYSIN.

    Sort commands are passed to SORT via SYSIN here.

    PARMS are also passed to SORT in the .CALL statement as opposed to passing them via DFSPARM.

    The SYSIN DD can contain parms like this:

    SORT FIELDS=COPY

    Note the above parms MUST start from column 2 of SYSIN and a space must be in column one as this is a DFSORT requirement.
    The "SORT FIELDS=COPY" in this case does a COPY from SORTIN to SORTOUT DD.
    The standard JCL to do this would be like this for SYSIN and call parms (same input file contents as above)

     //STEP1 EXEC PGM=SORT,        // PARM='MSGPRT=CRITICAL,ABEND,LIST'  //SYSOUT DD SYSOUT=A //SORTIN DD DSN=YOUR.SORTIN,DISP=OLD //SORTOUT DD DSN=YOUR.SORTOUT,DISP=OLD //SYSIN DD DSN=YOUR.SYSIN,DISP=OLD //* Using DSFPARM only: (same input file contents as above) //STEP1 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SORTDIAG DD SYSOUT=* //SORTIN DD DSN=YOUR.SORTIN,DISP=OLD //SORTOUT DD DSN=YOUR.SORTOUT,DISP=OLD //DFSPARM DD DSN=YOUR.DFSPARM,DISP=OLD //*