Database Management for Db2 for z/OS: How can Batch Processor be used to run DFSORT?
search cancel

Database Management for Db2 for z/OS: How can Batch Processor be used to run DFSORT?

book

Article ID: 48280

calendar_today

Updated On:

Products

Database Management for DB2 for z/OS - Administration Suite Database Management for DB2 for z/OS - Performance Suite Database Management for DB2 for z/OS - Recovery Suite Database Management for DB2 for z/OS - SQL Performance Suite Database Management for DB2 for z/OS - Utilities Suite DATABASE MANAGEMENT SOLUTIONS FOR DB2 FOR Z/OS DATABASE MANAGEMENT SOLUTIONS FOR IMS FOR Z/OS Batch Processor

Issue/Introduction

The Database Management Solutions for Db2 for z/OS .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.

Resolution

  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=hlq.CDBALOAD
    // DD DISP=SHR,DSN=hlq.SDSNEXIT
    // DD DISP=SHR,DSN=hlq.SDSNLOAD
    //PTILIB DD DISP=SHR,DSN=hlq.CDBALOAD
    // DD DISP=SHR,DSN=hlq.SDSNEXIT
    // DD DISP=SHR,DSN=hlq.SDSNLOAD
    //PTIPARM DD DISP=SHR,DSN=hlq.CDBAPARM
    //PTIXMSG DD DISP=SHR,DSN=hlq.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 called your.batch.processor.code(member) will contain the 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.

    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 the SYSLIB parameter is specified, there is no need to allocate a USERLIB. So in this case 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 Iuse ALLOC(NO) and enter your own dataset allocations for these.

    All SYSIN and DFSPARM datasets are allocated as FB LRECL 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
    //

     

Additional Information

.CALL Command -- Call the Execution Program

JCL Requirements

BPIIPT
Defines the input data set for the Batch Processor. The BPIIPT DD statement is read and executed after  the BPIOPT DD statement.