36. Execution in background (JCL)

To execute a RXS program in the background, make the following allocations in JCL:

·       DD name //SYSPROC must point to a library containing the REXX program RXS   

·       DD name //ISPLLIB must point to a library containing the load module RXSDO (If IBM language environment is not a default allocation on your installation, the library *.adcycle.le370.sceerun must be allocated too)

·       Remaining DD names for the execution of ISPF in the background must be found in the JCL (//ISPPROF, //ISPPLIB, //ISPSLIB, //ISPMLIB and //ISPTLIB). Allocate //ISPPROF as in the example below, and use the allocations normally used at your installation for the other DD names.

·       DD name //SYSTSIN must contain the string:                                                 ISPSTART CMD(RXS)

·       DD-name //RXSPGM must point to a dataset or member containg the program to be executed. Alternatively the program is stated inline as in the example below.

·       If general order out is given a value in the RXS program, this will function as usual: if the dataset exists, RXS will write to it. No JCL allocation of the dataset is needed.

·       If the RXS program writes to standard output, stdout, writing will take place in DD name //RXS. If no such DD name exists in the JCL, RXS will allocate a dataset according to its normal rules (section 32a).

·       If general order outfile is used in the RXS program, writing will take place in a file having this same name in the JCL. Example: If an action block writes to    outfile='yrsa', then DD name //YRSA will be used in the writing. If no such DD name exists in JCL, RXS will allocate a dataset according to its normal rules (section 32a).

·       If general order infile is used in the RXS program, reading will take place from a file having this same name in the JCL 

·       If general order func='prompt'is used in the RXS program, DD name //PROMPT must be found in the JCL. Assignments for the variables in the prompt must be stated under this DD name - one assignment per line. The syntax            variablename(assignment) must be used (See Example 36.2)

·       If general order prompt='xyz' is used in the RXS program, the DD name //XYZ must be found in the JCL. Assignments for the variables in the prompt must be stated under this DD name - one assignment per line. The syntax                  variablename(assignment) must be used

·       If )imbed is used, DD name //RXSLIB must point to a library (partitioned dataset) containing the RXS chunks to be imbedded

·       Error messages from RXS are written to DD name //SYSTSPRT. The RXS step in error is terminated with return code RC=16. A message on screen notify the user that //SYSTSPRT should be checked

·       A programmed exit is propagated up to the background job: When programming, say, exit 12  in RXS, the job will terminate with return code RC=12.

 

Example 36.1:

//PROFALL EXEC PGM=IEFBR14                                    

//PROFDSN DD DSN=&&PROFIL,DISP=(NEW,PASS),UNIT=VIO,           

//        DCB=(BLKSIZE=6080,LRECL=80,RECFM=FB,DSORG=PO),      

//        SPACE=(TRK,(1,1,1))                                 

//*                                                            

//RXSSTEP EXEC PGM=IKJEFT1B,DYNAMNBR=30

//SYSPROC DD DSN=MYQUALIF.MYPROC,DISP=SHR                    

//ISPPROF DD DSN=&&PROFIL,DISP=OLD,UNIT=SYSDA                 

//ISPLLIB DD DSN=??.ADCYCLE.LE370.SCEERUN,DISP=SHR

//        DD DSN=MYQUALIF.ISPLLIB,DISP=SHR                     

//ISPTLIB DD DSN=??  

//ISPMLIB DD DSN=??                 

//ISPSLIB DD DSN=??                 

//ISPPLIB DD DSN=??                                

//ISPLOG  DD DUMMY                                             

//SYSTSPRT DD SYSOUT=T                                        

//SYSTSIN  DD  *                                              

 ISPSTART CMD(RXS) 

//RXSPGM DD *

)action

nbr = random()

'Square of 'nbr' is 'nbr**2

)endaction                                   

//RXSLIB DD DSN=MYQUALIF.RXSLIB,DISP=SHR            

//RXS     DD DSN=MYQUALIF.MY.OUTPUT,DISP=(NEW,...

 

Submitting this JCL will create the dataset  MYQUALIF.MY.OUTPUT consisting one line:

Square of 117 is 13689

or whatever the random number is.

 

//ISPMLIB and //ISPSLIB is not used by RXS, but they are needed to start ISPF in the background

In RXS everything will function normally, except:

 

Notice: Even reading from and writing to a PC dataset works in the background: A background job on the mainframe may read or write to any PC, if permission is granted by the 'IBM workstation agent' program on the PC. According to section 28.

A debugging tip: Marking the RXS program in the JCL above using line commands 'cc' 'cc' and entering ==> rxs in the command prompt, will execute the RXS program directly.

Warning:

 '/*' in column 1 in JCL unfortunalely marks the end of a SYSIN-dataset. Therefore comments in the RXS program having /* in column 1 will terminate the reading of the program.

 

Example 36.2:

Execution of the RXS-program 'myrxs' from JCL. The program resides as a member on the dataset MYQUALIF.RXSLIB. The program 'myrxs' uses an action block using func='prompt' to get values for account and department. ('myrxs' could be the RXS program in example 21.3).

//PROFALL EXEC PGM=IEFBR14                                    

//PROFDSN DD DSN=&&PROFIL,DISP=(NEW,PASS),UNIT=VIO,            

//        DCB=(BLKSIZE=6080,LRECL=80,RECFM=FB,DSORG=PO),      

//        SPACE=(TRK,(1,1,1))                                 

//*                                                           

//RXSSTEP EXEC PGM=IKJEFT1B,DYNAMNBR=30

//SYSPROC DD DSN=MYQUALIF.MYPROC,DISP=SHR                    

//ISPPROF DD DSN=&&PROFIL,DISP=OLD,UNIT=SYSDA                 

//ISPLLIB DD DSN=MYQUALIF.ISPLLIB,DISP=SHR

//ISPTLIB DD DSN=??  

//ISPMLIB DD DSN=??                 

//ISPSLIB DD DSN=??                 

//ISPPLIB DD DSN=??                                

//ISPLOG  DD DUMMY                                            

//SYSTSPRT DD SYSOUT=T                                        

//SYSTSIN  DD  *                                              

 ISPSTART CMD(RXS MYRXS)                                    

//RXSLIB DD DSN=MYQUALIF.RXSLIB,DISP=SHR            

//RXS     DD DSN=MYQUALIF.MY.OUTPUT,DISP=(NEW,...

//PROMPT DD *                                                  

ACCOUNT(1448)

DEPARTMENT(SALES)        

 

This last example is omitting //RXSPGM and pointing //SYSTSIN to

ISPSTART CMD(RXS MYRXS)

This way RXS programs using parm-strings may be executed in background:

ISPSTART CMD(RXS OURRXS what's up doc?)

will execute the command OURRXS using parameter what's up doc?

 

Example 36.3

Building a JCL-procedure:

Due to an error in ISPF, running multiple instances of RXS in background will collide when using //ISPTLIB. The solution is this modificated JCL:This is the way to build a JCL procedure for background execution of RXS:

//COPYTLIB EXEC PGM=IEBCOPY

//SYSUT1 DD DSN=SYS2.DCISPF.ISPTLIB,DISP=SHR

//SYSUT2 DD DSN=&&ISPTLIB,DISP=(NEW,PASS),UNIT=VIO,

//            DCB=(BLKSIZE=6080,LRECL=80,RECFM=FB,DSORG=PO),

//            SPACE=(TRK,(3,3,3))

//SYSPRINT DD SYSOUT=T

//SYSIN DD *

COPY OUTDD=SYSUT2,INDD=SYSUT1

SELECT MEMBER=(ISPCMDS,ISPFCMDS,ISPKEYS,ISPPROF,ISPSPROF)

//*

//RXSBAGAL EXEC PGM=IEFBR14

//DSN1     DD DSN=&&PROFIL,DISP=(NEW,PASS),UNIT=VIO,

//            DCB=(BLKSIZE=6080,LRECL=80,RECFM=FB,DSORG=PO),

//            SPACE=(TRK,(1,1,1))

//*

//RXSDO    EXEC PGM=IKJEFT1B,DYNAMNBR=30

//SYSPROC  DD DSN=SDBNYSL.PROJ.CLIST,DISP=SHR

//ISPPROF  DD DSN=*.RXSBAGAL.DSN1,DISP=OLD

//ISPMLIB  DD DSN=SYS2.DCISPF.ISPMLIB,DISP=SHR

//ISPSLIB  DD DSN=SYS2.DCISPF.ISPSLIB,DISP=SHR

//ISPPLIB  DD DSN=SYS2.DCISPF.ISPPLIB,DISP=SHR

//ISPLLIB  DD DSN=SYS2.ADCYCLE.LE370.SCEERUN,DISP=SHR

//ISPLLIB  DD DSN=SDBISPF.BSPF.LOAD,DISP=SHR

//ISPTLIB  DD DSN=&&ISPTLIB,DISP=SHR

//ISPLOG   DD DUMMY

//RXSLIB   DD DSN=SDBNYSL.PROJ.RXSLIB,DISP=SHR

//SYSTSIN  DD *

ISPSTART CMD(RXS)

//SYSTSPRT DD SYSOUT=T

//SYSUDUMP DD SYSOUT=T

//RXSPGM is to be added when calling the JCL procedure.

Notice: handling large data structures in RXS consumes large amounts of memory. Using REGION=0K in the JOB-card is recommended, as it will maximise the possible amount of high memory.