Initializing the SRB

Before a program schedules an SRB, it must obtain 44 bytes of storage for the SRB and initialize its fields. Either the scheduling program or the SRB must free this storage when the SRB is no longer needed.

The SRB can be reused or freed. If you scheduled the SRB with MODE=FULLXM, you can free or reuse the SRB immediately after it has been scheduled. If the scheduling program passed a parameter list to the SRB routine, you must free or reuse only the SRB. The parameter list must remain available to the SRB routine until it has completed processing. If you scheduled the SRB with MODE=NONXM, the scheduling program must provide the serialization to ensure that it doesn't reuse, change, or free the SRB before the SRB routine begins to run.

The IHASRB macro maps the structure of an SRB; include IHASRB in your program. To see the format of the SRB, see the SRB data area see z/OS MVS Data Areas in the z/OS Internet library.

Use the following information to help you initialize the SRB. First, set the SRB to zeroes, then initialize the fields. The values of all fields not mentioned in this information should be zero.
SRBASCB
Contains the address of the ASCB of the address space in which the SRB routine will run, if the SRB was scheduled without duplicating the scheduling program's cross-memory environment (MODE=NONXM). To make sure that you identify the address space correctly, use the STOKEN parameter on the SCHEDULE macro. The system makes sure that the address space that SRBASCB points to is active and the same as the one that the STOKEN parameter identifies.
Note: If the SRB was scheduled with cross-memory services (MODE=FULLXM), this field does not contain useable information.
SRBPKF
Indicates, in the four high-order bits, the PSW key of the SRB routine. The four low-order bits must be zero.
SRBEP
Specifies the address of the entry point of the SRB routine. If the SRB routine is to run in 31-bit addressing mode, set the high-order bit in the field to 1; if the routine is to run in 24-bit addressing mode, set the high-order bit to 0.
SRBPARM
Contains the address of a user parameter area. Through this field, the scheduling program passes information to the SRB routine.
SRBRMTR
Contains the address of a resource manager termination routine (RMTR). This routine is responsible for cleaning up an SRB that has been scheduled but not yet dispatched. The RMTR is required and must be in common storage. SRBRMTR must contain a valid nonzero address. If the RMTR is to run in 31-bit addressing mode, set the high-order bit in the field to 1. If the RMTR is to receive control with the local lock, set bit 31 in the field to 1 (SRBRMTLL). For information about the RMTR, see The resource manager termination routine (RMTR).
SRBPTCB
Contains the address of a TCB that is associated with the SRB routine. The system uses this address in two ways:
  • If the SRB routine abnormally ends and its FRR does not exist or does not retry, the task is scheduled for abnormal termination.
  • If the specified task terminates, the system purges the SRB and gives the RMTR control.

    If this SRB is not related to any task, or purging is not necessary, specify a zero value.

SRBPASID
Contains the ASID of the address space associated with the SRB routine. If you specified a nonzero value in SRBPTCB, you must specify a value for SRBPASID; the value must contain the ASID of the address space containing that TCB. Otherwise, this field can be zeroes. If the specified address space terminates, the system purges the specified SRB and gives control to the RMTR. SRBPASID does not need to represent the same address space as SRBASCB.
SRBFRRA
Contains the address of an FRR that receives control if the SRB routine abnormally ends. If the FRR is to run in 31-bit addressing mode, set the high-order bit in the field to 1; if the routine is to run in 24-bit addressing mode, set the high-order bit to 0. SRBFRRA is needed only when FRR=YES.