REXX SPOC batch job example

These examples provide a sample batch job, a sample REXX SPOC program, and job output from the REXX SPOC example.

Sample REXX SPOC batch job

The batch job shown in the following figure calls the batch TSO command processor to get a response that contains all transactions that start with the letter V.

    //REXXSPOC JOB ,                                                   
    //   MSGCLASS=H,NOTIFY=USRT002,USER=USRT002,TIME=(,30)             
    //*                                                                
    //SPOC     EXEC PGM=IKJEFT01,DYNAMNBR=45                           
    //STEPLIB  DD DISP=SHR,DSN=IMS.SDFSRESL                 
    //SYSPROC  DD DISP=SHR,DSN=LOCAL.IMS.CLIST                     
    //SYSTSPRT DD SYSOUT=A                                             
    //SYSTSIN  DD *                                                    
      %REXXSPOC QRY TRAN NAME(V*)                                      
    /*EOF                                                              

The DD names in this batch job include:

STEPLIB
Contains the load modules.
SYSPROC
Contains the REXX programs.
SYSTSPRT
Contains the output produced by the REXX program.
SYSTSIN
Contains the command to execute, including its parameters.

The QRY TRAN command in the JCL is passed as an argument to the following sample REXX program. The command is issued, and the response is sent to the SYSTSPRT file.

REXX SPOC sample program

The following figure shows the sample REXX program, REXXSPOC.

/* rexx */ 
parse upper arg theIMScmd 
Address LINK 'CSLULXSB'                                          
if rc = 0 then 
 do 
   Address IMSSPOC 
   "IMS plex1" ; if rc > 0 then say 'rc='imsrc 'reason='imsreason 
   "route ims2"; if rc > 0 then say 'rc='imsrc 'reason='imsreason 
   cartid = "TEST13" 
   "cart" cartid ; if rc > 0 then say 'rc='imsrc 'reason='imsreason 
   "WAIT 1:00" ; if rc > 0 then say 'rc='imsrc 'reason='imsreason 
   theIMScmd 
   if rc > 0 then say 'rc='rc 'imsrc='imsrc 'reason='imsreason 
      do 
        results = cslulgts('TEMP.', cartid,"1:30") 
        say 'results='results ' imsrc='imsrc ' reason='imsreason 
        if temp.0 /= '' then 
          do 
            say 'temp.'0'=('temp.0')' 
            do idx = 1 to temp.0 
              say 'temp.'idx'= 'temp.idx 
            end 
          end 
      end 
"END" 
End 
exit 

Sample output

The output from the REXXSPOC sample program is shown in the following output example.

READY 
%REXXSPOC QRY TRAN NAME(V*) 
results=00000000X imsrc=00000000X reason=00000000X 
temp.0=(30) 
temp.1= <imsout> 
temp.2= <ctl> 
temp.3= <omname>OM1OM </omname> 
temp.4= <omvsn>1.1.0</omvsn> 
temp.5= <xmlvsn>1 </xmlvsn> 
temp.6= <statime>2001.198 16:08:39.944953</statime> 
temp.7= <stotime>2001.198 16:08:40.271944</stotime> 
temp.8= <staseq>B625CACD49AF914A</staseq> 
temp.9= <stoseq>B625CACD99848CC6</stoseq> 
temp.10= <rqsttkn1>TEST13 </rqsttkn1> 
temp.11= <rc>00000000</rc> 
temp.12= <rsn>00000000</rsn> 
temp.13= </ctl> 
temp.14= <cmd> 
temp.15= <master>IMS2 </master> 
temp.16= <userid>USRT002 </userid> 
temp.17= <verb>QRY </verb> 
temp.18= <kwd>TRAN </kwd> 
temp.19= <input>QRY TRAN NAME(V*)</input> 
temp.20= </cmd> 
temp.21= <cmdrsphdr> 
temp.22= <hdr slbl="TRAN" llbl="Trancode" scope="LCL" sort="a" 
key="1" scroll="no" len="8" dtype=" CHAR" align="left" /> 
temp.23= <hdr slbl="MBR" llbl="MbrName" scope="LCL" sort="a" 
key="4" scroll="no" len="8" dtype="CHAR" align="left" /> 
temp.24= <hdr slbl="CC" llbl="CC" scope="LCL" sort="n" 
key="0" scroll="yes" len="4" dtype="INT" align="right" /> 
temp.26= </cmdrsphdr> 
temp.26= <cmdrspdata> 
temp.27= <rsp>TRAN(VIDB ) MBR(IMS2 ) CC( 0) </rsp> 
temp.28= <rsp>TRAN(VIDA ) MBR(IMS2 ) CC( 0) </rsp> 
temp.29= </cmdrspdata> 
temp.30= </imsout> 
READY 
END