Batch Processor: Issue DB2 Commands Online or in Batch.
search cancel

Batch Processor: Issue DB2 Commands Online or in Batch.

book

Article ID: 48261

calendar_today

Updated On:

Products

Database Management for DB2 for z/OS - Administration Suite

Issue/Introduction

Batch processor is able to process the standard DB2 Commands such as -START or -STOP or -DISPLAY in batch or online. It might be handy to add such commands into a job stream to carry out useful functions.

 

Environment

Release: R20
Component: RBP

Resolution

The DB2 commands to be executed by batch processor must be enclosed in a batch processor command list:

Here is an example:

 

.CALL DSN PARM(ssid)
.DATA
-STOP DATABASE (DBCORP1) SPACENAM(*)
-DISPLAY DATABASE (DBCORP1) LIMIT(300)
-START DATABASE (DBCORP1) SPACENAM(*)
-DISPLAY DATABASE (DBCORP1) LIMIT(300)
-DISPLAY UTILITY (*)
.ENDDATA

 

The .CALL DSN command calls the DB2 command processor passing the subsystem id.

The DB2 commands are enclosed by a .DATA and .ENDDATA so that the command processor knows where the last command is. The commands are executed one by one.

This command list can be executed online by batch processor using the Batch Processor Interface specifying EXECUTION MODE ===> O

The output is displayed on the screen. This output could be sent to a dataset using the QFILE command on the command line.

This command list can be executed in batch also using the standard JCL for batch processor  Interface specifying EXECUTION MODE ===> B…..nothing else needed.

Add your commands into the BPIIPT dd.

//STEP1    EXEC PGM=PTLDRIVM,REGION=4M,PARM='EP=BPLBCTL'
//STEPLIB  DD DISP=SHR,DSN=hlq.CDBALOAD
//         DD DISP=SHR,DSN=ssid.PRIVATE.SDSNEXIT
//         DD DISP=SHR,DSN=DB2.SDSNLOAD
//PTILIB   DD DISP=SHR,DSN=hlq.CDBALOAD
//         DD DISP=SHR,DSN=ssid.PRIVATE.SDSNEXIT
//         DD DISP=SHR,DSN=DB2.SDSNLOAD
//PTIPARM  DD DISP=SHR,DSN=hlq.CDBAPARM
//PTIXMSG  DD DISP=SHR,DSN=hlq.CDBAXMSG
//SYSOUT   DD SYSOUT=*
//PTIIMSG  DD SYSOUT=*
//UTPRINT  DD SYSOUT=*
//ABNLIGNR DD DUMMY                 SUPPRESS ABENDAID DUMPS
//SYSUT1   DD UNIT=SYSDA,SPACE=(CYL,(30,30))
//SYSREC   DD UNIT=SYSDA,SPACE=(TRK,(1,1))
//BPIIPT   DD DISP=SHR,
//        DSN=hlq.BPCODE(COMMANDS)
//BPIOPT   DD   *
.CONTROL BPID(hlq.BPCODE-COMMANDS) +
LOGID(ssid) UNIT(SYSDA)
.LIST SYSOUT(X,,A)
.OPTION NOERRORS NOSQLERRORS RETRY(01) NOBINDERRORS    +
 WRAPLINE
.RESTART OVERRIDE
.CONNECT ssid

You might specify a .RESTART OVERRIDE above in case one of the commands fails as it will leave the Batch Processor in a restart condition. In this way the job can simply be resubmitted from the start.

The output is directed to an existing dataset also:

Instead of

.LIST SYSOUT(A,,X)

use

.LIST FILE(hlq.your.sysout)

This would help to preserve the output if needed for auditing.

Additional Information

.CALL Command -- Call the Execution Program