Execute an operator command via JCL

  • Post category:JCL
  • Reading time:1 mins read

In my previous post I shared a way to execute operator command from a batch job using Rexx and SDSF. That is of course a bit cumbersome if you just want to fire off a fixed operator command.

Therefore here the simplest way to execute an operator command:

https://github.com/execpgm/execpgm-assets/blob/master/Tools/OperatorCommandJCL.txt

//...jobcard                     
//EXECCMD EXEC PGM=IEFBR14                        
// COMMAND 'D A,L'  

Db2 SQL in batch

  • Post category:JCL
  • Reading time:1 mins read

Again a simple solution for a common problem: how to run a Db2 query from a batch script. Here we use the utility DSNTEP2 that is provided for this purpose with the Db2 installation.

In the STEPLIB, specify your names for Db2 runtime libraries.

In the SYSTEM (xxxx) clause specify your Db2 subsystem.

The SQL in the SYSIN label can be taken from in-stream, or from a dataset as below.

//GO EXEC PGM=IKJEFT01,DYNAMNBR=20 
//STEPLIB DD DSN=SYS2.SDSNEXIT,DISP=SHR 
//        DD DSN=SYS2.SDSNLOAD,DISP=SHR     
//SYSTSPRT DD SYSOUT=*  
//SYSTSIN DD * 
 DSN SYSTEM (xxxx)                                       
 RUN PROG (DSNTEP2)
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//*SYSIN    DD DISP=SHR,DSN=YOURDSN.DB2.SQL(YOURSQL) OR
//SYSIN    DD *
 SELECT * FROM YOURTABLE
/*

//Dean