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 SuiteDatabase Management for DB2 for z/OS - Performance SuiteDatabase Management for DB2 for z/OS - Recovery SuiteDatabase Management for DB2 for z/OS - SQL Performance SuiteDatabase Management for DB2 for z/OS - Utilities SuiteDATABASE MANAGEMENT SOLUTIONS FOR DB2 FOR Z/OSDATABASE MANAGEMENT SOLUTIONS FOR IMS FOR Z/OSBatch 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
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.
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)