How to run DB2 SPUFI from a REXX in an Endevor Processor

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

Description:

When you generate an element in foreground, and the processor logic requires a DB2 step that updates a DB2 table using a SPUFI command, you can create a REXX procedure and use the Endevor BC1PTMP0 Utility to accomplish this. This Technote provides a sample of how to do this.

Solution:

When generating an element in foreground, and you are required to use DB2 SPUFI to update tables, the following REXX can be used in a processor using the BC1PTMP0 Utility. Below is a sample of the REXX and the proecssor that you can use within CA Endevor.

--------------------------------------------------
REXX to be invoked by BC1PTMP0:
--------------------------------------------------

trace Off   
Parse Upper Arg DsnSyst .   
Call InitPart   
Call DB2Trt   
Exit   
  
/*--- Run main routine ---*/   
DB2Trt :   
 Starter = 'DSN ' !! DsnSyst   
 "Newstack"   
 QUEUE "RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2) LIB('D007310.DB2V000.RUNLIB.LOAD')"   
 QUEUE "END"   
 ADDRESS TSO Starter   
Return
/*--- recuperate DB2 parms ---*/ 
InitPart :    
Point = '.' /* dot character . (dot) */    
TblErr. = '' /* error messages table */    
TblErr.0 = 0 /* number of items for table tblerr. */    
If DsnSyst = ''    
  Then Do    
   'EXECIO 1 DISKR SYPSIN (FINIS'    
   If RC ^= 0    
     Then Call ERROR 'N' RC 'E001 READ ERROR FILE SYPSIN'    
    Else Parse Pull ParmLu    
End    
Parse Var ParmLu DsnSyst.
Return
/*--- Errors routine ---*/    
Error:    
    
Parse Arg ERRFLG ERRRC ERRTEXT    
TBLERR.0 = TBLERR.0 + 1    
IERR = TBLERR.0    
If ( ERRRC ^= POINT )    
    Then TBLERR.IERR = ' RC='ERRRC', 'ERRTEXT    
    Else TBLERR.IERR = ' 'ERRTEXT    
/**/    
If ( ERRFLG ^= POINT ) Then    
    OK = ERRFLG    
If ( ERRRC ^= POINT ) Then    
    $ERRC = ERRRC    
    
Return    
= 

--------------------------------------------------
Endevor Processor used:
--------------------------------------------------

 ....... 
//* STEP TO DEFINE DB2 PARM   
//*   
//CRPARIN EXEC PGM=C1PRMGEN,   
//     PARM=' &DBDL '   
//PARMOUT DD DSN=&&PARMSIN,DISP=(,PASS,DELETE),   
//     DCB=(RECFM=FB,LRECL=80,BLKSIZE=80)   
//*   
//* STEP TO DELETE   
//*   
//DELEATZ0 EXEC PGM=BC1PTMP0,MAXRC=101,   
//     PARM='GBD2039.DOMAIN10.EXEC2(RUNDB3)'   
//*    PARM='GBD2039.DOMAIN10.CLIST(CRUNDB3)'   
//SYSIN    DD DSN=&&MSGDELT,DISP=SHR   
//SYPSIN   DD DSN=&&PARMSIN,DISP=SHR   
//STEPLIB  DD DSN=&DB2RUN,DISP=SHR   
//         DD DSN=&DB2EXT,DISP=SHR   
//         DD DSN=&DB2DSN,DISP=SHR   
//SYSPRINT DD DISP=SHR,DSN=&&SPRINT   
//SYSERR   DD DSN=&&DELERR,DISP=SHR   
//SYSMAP   DD DSN=&&DELMAP,DISP=SHR   
//EN$SELCT DD DUMMY   
//*   
//DELEAT00 EXEC PGM=IKJEFT01,MAXRC=101,COND=(5,NE,DELEATZ0)   
//STEPLIB   DD DSN=&DB2RUN,DISP=SHR   
//          DD DSN=&DB2DSN,DISP=SHR   
//SYSPRINT  DD SYSOUT=*   
//SYSUDUMP  DD SYSOUT=*   
//SYSTSPRT  DD SYSOUT=*   
//SYSOUT    DD SYSOUT=*         
//SYSDBOUT  DD SYSOUT=* 
//SYSABEND  DD SYSOUT=*  
//ABNLDUMP  DD SYSOUT=*  
//SYSOUD    DD SYSOUT=*  
//SYSERR    DD DSN=&&DELERR,DISP=SHR  
//SYSMAP    DD DSN=&&DELMAP,DISP=SHR  
//SYSTSIN   DD *  
DSN &DBDL  
RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2)  
END  
//SYSDISC DD DUMMY  
//SYSIN   DD DSN=&&MSGDELT,DISP=SHR  
//*  
//* STEP INSERT  
//*  
//ISRTMESZ EXEC PGM=BC1PTMP0,MAXRC=8,  
// PARM='GBD2039.DOMAIN10.EXEC2(RUNDB3)'  
//STEPLIB   DD DSN=&DB2RUN,DISP=SHR  
//          DD DSN=&DB2EXT,DISP=SHR  
//          DD DSN=&DB2DSN,DISP=SHR  
//SYSUDUMP  DD SYSOUT=*  
//SYSPRINT  DD DISP=SHR,DSN=&&SPRINT  
//SYSOUT    DD SYSOUT=*  
//SYSDBOUT  DD SYSOUT=*  
//SYSABEND  DD SYSOUT=*  
//ABNLDUMP  DD SYSOUT=*  
//SYSOUD    DD SYSOUT=*  
//SYSERR    DD DSN=&&ISRTERR,DISP=SHR  
//SYSMAP    DD DSN=&&ISRTMAP,DISP=SHR  
//SYSDISC   DD DUMMY  
//SYSIN     DD DSN=&&MSGISRT,DISP=SHR  
//SYPSIN    DD DSN=&&PARMSIN,DISP=SHR  
//EN$SELCT  DD DUMMY  
//*
//ISRTMESS EXEC PGM=IKJEFT01,MAXRC=4,COND=(5,NE,ISRTMESZ) 
//STEPLIB  DD DSN=&DB2RUN,DISP=SHR  
//         DD DSN=&DB2DSN,DISP=SHR  
//SYSPRINT DD SYSOUT=*  
//SYSUDUMP DD SYSOUT=*  
//SYSTSPRT DD SYSOUT=*  
//SYSOUT   DD SYSOUT=*  
//SYSDBOUT DD SYSOUT=*  
//SYSABEND DD SYSOUT=*  
//ABNLDUMP DD SYSOUT=*  
//SYSOUD   DD SYSOUT=*  
//SYSERR   DD DSN=&&ISRTERR,DISP=SHR  
//SYSMAP   DD DSN=&&ISRTMAP,DISP=SHR  
//SYSTSIN  DD *  
DSN &DBDL  
RUN PROGRAM(DSNTEP2) PLAN(DSNTEP2)  
END  
//SYSDISC DD DUMMY  
//SYSIN DD DSN=&&MSGISRT,DISP=SHR  
.....  
  --------------------------------------------------