Use the IEAMSCHD macro to schedule a service request block (SRB) for asynchronous execution. When you schedule an SRB, you can specify dispatching priority and processor affinity. Preemptable SRBs (PRIORITY=CLIENT,PRIORITY=ENCLAVE, or PRIORITY=PREEMPT) can also be scheduled with a minor priority.
The scheduling program can specify an RMTR to be invoked by the PURGEDQ service. The RMTR is responsible for cleaning up resources on behalf of an SRB routine if it has been purged by PURGEDQ before it is dispatched.
IBM® recommends using IEAMSCHD rather than the SCHEDULE macro. For information about how to schedule an SRB, see z/OS MVS Programming: Authorized Assembler Services Guide.
The requirements for the caller are:
Environmental factor | Requirement |
---|---|
Minimum authorization: | PSW key 0-7, or supervisor state with any PSW key. |
Dispatchable unit mode: | Task or SRB |
Cross memory mode: | Any HASN, any PASN, any SASN |
AMODE: | 31-bit |
ASC mode: | Primary, or access register |
Interrupt status: | Enabled or disabled for I/O and external interrupts |
Locks: | The caller may hold locks, but is not required to hold any. A caller who specifies SYNCH=YES cannot hold any locks. |
Control parameters: | Control parameters must be in the primary address space. |
Before issuing the IEAMSCHD macro, the caller does not have to place any information into any register unless using it in register notation for a particular parameter, or using it as a base register.
Some callers depend on register contents remaining the same before and after issuing a service. If the system changes the contents of registers on which the caller depends, the caller must save them before issuing the service, and restore them after the system returns control.
None.
The standard form of the IEAMSCHD macro is written as follows:
Syntax | Description |
---|---|
name | name: symbol. Begin name in column 1. |
␢ | One or more blanks must precede IEAMSCHD macro. |
IEAMSCHD | |
␢ | One or more blanks must follow IEAMSCHD macro. |
EPADDR=epaddr | epaddr: RS-type address or register (2) - (12). |
,ENV=HOME | Default: HOME |
,ENV=PRIMARY | |
,ENV=FULLXM | |
,ENV=STOKEN | |
,TARGETSTOKEN=targetstoken | targetstoken: RS-type address or register (2) - (12). |
,FEATURE=NONE | Default: NONE |
,FEATURE=CRYPTO | |
,FEATURE=CPMASK | |
,PRIORITY=LOCAL | Default: LOCAL |
,PRIORITY=GLOBAL | |
,PRIORITY=CURRENT | |
,PRIORITY=PREEMPT | |
,PRIORITY=CLIENT | |
,PRIORITY=ENCLAVE | |
,MINORPRIORITY=ZERO | Default: ZERO |
,MINORPRIORITY=minorpriority | minorpriority: RS-type address or register (2) - (12). |
,SRBIDTOKEN=token | token: 16-byte output area. |
,CLIENTSTOKEN=clientstoken | clientstoken: RS-type address or register (2) - (12). |
,ENCLAVETOKEN=enclavetoken | enclavetoken: RS-type address or register (2) - (12). |
,PARM=ZERO | Default: ZERO |
,PARM=parm | parm: RS-type address or register (2) - (12). |
,FRRADDR=NOFRR | Default: NOFRR |
,FRRADDR=frraddr | frraddr: RS-type address or register (2) - (12). |
,SDWALOC31=NO | Default: NO |
,SDWALOC31=YES | |
,KEYVALUE=INVOKERKEY | Default: INVOKERKEY |
,KEYVALUE=keyvalue | keyvalue: RS-type address or register (2) - (12). |
,LLOCK=NO | Default: NO |
,LLOCK=YES | |
,RMTRADDR=NORMTR | Default: NORMTR |
,RMTRADDR=rmtraddr | rmtraddr: RS-type address or register (2) - (12). |
,PURGESTOKEN=NOPSTOKEN | Default: NOPSTOKEN |
,PURGESTOKEN=purgestoken | purgestoken: RS-type address or register (2) - (12). |
,PTCBADDR=NOPTCB | Default: NOPTCB |
,PTCBADDR=ptcbaddr | ptcbaddr: RS-type address or register (2) - (12). |
,FLAGS=NO_FLAGS | Default: NO_FLAGS |
,FLAGS=flags | flags: RS-type address or register (2) - (12). |
,SYNCH=NO | Default: NO |
,SYNCH=YES | |
,SYNCHCOMPADDR=NOVALUE | Default: NOVALUE |
,SYNCHCOMPADDR=compaddr | compaddr: RS-type address or register (2) - (12). |
,SYNCHCODEADDR=codeaddr | codeaddr: RS-type address or register (2) - (12). |
,SYNCHRSNADDR=rsnaddr | rsnaddr: RS-type address or register (2) - (12). |
,RETCODE=retcode | retcode: RS-type address or register (2) - (12). |
,PLISTVER=IMPLIED_VERSION | Default: PLISTVER=IMPLIED_VERSION |
,PLISTVER=MAX | |
,PLISTVER=0 | |
,PLISTVER=1 | |
,MF=S | Default: MF=S |
,MF=(L,list addr) | list addr: RS-type address or register (1) - (12). |
,MF=(L,list addr,attr) | |
,MF=(L,list addr,0D) | |
,MF=(E,list addr) | |
,MF=(E,list addr,COMPLETE) | |
The parameters are explained as follows:
To code: Specify the name (RS-type), or address in register (2)-(12), of a required 4-byte input parameter.
Default: HOME
This provides the SRB routine with addressability to the same address spaces and data spaces as the scheduling program.
To code: Specify the name (RS-type), or address in register (2)-(12), of a required 64-bit input parameter.
Default: LOCAL
Task Mode Callers: For task mode callers, the SRB is always preemptable. If the task has joined an enclave, the SRB routine inherits the enclave's major priority and the task's minor priority. Otherwise, the SRB routine inherits the major priority of the task's home address space and the minor priority of the task. If the scheduling task and the scheduled SRB have different home address spaces, then the scheduled SRB is also converted to a client SRB.
Preemptable SRB Mode Callers: For preemptable SRB mode callers, the scheduled SRB is always preemptable. If the scheduling SRB was scheduled into an enclave, the scheduled SRB inherits the enclave's major priority and the scheduling SRB's minor priority. Otherwise, the scheduled SRB inherits the major priority of the scheduling SRB's home address space and the minor priority of the scheduling SRB. If the scheduling SRB and the scheduled SRB have different home address spaces, then the scheduled SRB is also converted to a client SRB.
The minor priority parameter assigns the SRB routine a priority that is comparable to a task's dispatching priority in the address space. The caller can specify priorities for SRB routines so that they are dispatched before, with, or after tasks in the address space.
Default: ZERO
To code: Specify the name (RS-type), or address in register (2)-(12), of an 8-bit input parameter. MINORPRIORITY is optional for PRIORITY=PREEMPT, PRIORITY=CLIENT, and PRIORITY=ENCLAVE.
SRBIDTOKEN is optional for PRIORITY=PREEMPT, PRIORITY=CLIENT, and PRIORITY=ENCLAVE.
To code: Specify the name (RS-type), or address in register (2)-(12), of a required 64-bit parameter.
To code: Specify the name (RS-type), or address in register (2)-(12), of an 8-character input parameter. ENCLAVETOKEN=enclavetoken is required for PRIORITY=ENCLAVE.
Default: NONE
Default: NO
The FRR receives control in supervisor state, PSW key 0, primary ASC mode, 31-bit addressing mode, holding the same locks the SRB routine held at the time of error. The FRR receives control with the same PASID, SASID, and HASID as the SRB routine had on entry.
If you specify LLOCK=YES, then the FRR should release the LOCAL lock prior to the completion of its processing.
Default: NOFRR. The SRB routine will receive control without its own FRR.
To code: Specify the name (RS-type), or address in register (2)-(12), of an optional 4-byte input parameter.
Default: NO
Default: INVOKERKEY
If INVOKERKEY is not specified the SRB routine receives control with the PSW key of the invoker of the IEAMSCHD macro.
To code: Specify the name (RS-type), or address in register (2)-(12), of an optional 8-bit input parameter.
The RMTR must reside in the MVS common area because the address space where the RMTR will get control is unpredictable at the time of the invocation of the IEAMSCHD macro. It is called from the PURGEDQ service and will receive control in task mode, supervisor state, PSW key 0, primary ASC mode, and 31-bit AMODE. If bit 31 of the RMTRADDR is one, control is received with the local lock held and control can return to the PURGEDQ service with or without the local lock held, but must not hold any other locks upon return. If bit 31 of the RMTRADDR is zero, control is received with no locks held and control must be returned to the PURGEDQ service with no locks held. Bit 31 of RMTRADDR is treated as zero when determining the RMTR address.
Default: NORMTR
To code: Specify the name (RS-type), or address in register (2)-(12), of an optional 4-byte input parameter.
Default: ZERO
To code: Specify the name (RS-type), or address in register (2)-(12), of a fullword input parameter.
The address space represented by the purgestoken does not have to be the same as the address space where the SRB routine will be dispatched.
Default: NOPSTOKEN
To code: Specify the name (RS-type), or address in register (2)-(12), of an optional 64-bit input parameter.
If you specify PTCBADDR, then you must specify PURGESTOKEN.
Default: NOPTCB
To code: Specify the name (RS-type), or address in register (2)-(12), of an optional 4-byte input parameter.
Default: NO_FLAGS
To code: Specify the name (RS-type), or address in register (2)-(12), of an optional 1-byte input output parameter.
Default: NO
Default: NOVALUE
To code: Specify the name (RS-type) of an optional 4-byte input area that contains the address of the fullword that is to hold the data to be returned. When you specify this parameter, you must also specify SYNCHCODEADDR and SYNCHRSNADDR, which can provide additional information about the completion code.
For example, if SYNCHCOMPADDR contains a completion code of 8, then SYNCHCODEADDR contains an abend code. (If the scheduled SRB exits with the TCTL macro, SYNCHCODEADDR does not contain meaningful data; its contents are unpredictable.)
To code: Specify the name (RS-type) of an optional 4-byte input area that contains the address of the fullword that is to hold the data to be returned.
For example, if SYNCHCOMPADDR contains a completion code of 8, then SYNCHCODEADDR contains an abend code, and SYNCHRSNADDR contains the reason code associated with the abend code. (If the scheduled SRB exits with the TCTL macro, SYNCHCODEADDR and SYNCHRSNADDR do not contain meaningful data; the contents of both are unpredictable.)
To code: Specify the name (RS-type) of an optional 4-byte input area that contains the address of the fullword that is to hold the data to be returned.
To code: Specify the RS-type address of a fullword field, or register (2)-(12).
To code: Specify the RS-type address of a fullword field, or register (2)-(12).
If you can tolerate the size change, IBM recommends that you always specify PLISTVER=MAX on the list form of the macro. Specifying MAX ensures that the list-form parameter list is always long enough to hold all the parameters you might specify on the execute form; in this way, MAX ensures that the parameter list does not overwrite nearby storage.
Use MF=S to specify the standard form of the macro, which builds an inline parameter list and generates the macro invocation to transfer control to the service. MF=S is the default.
Use MF=L to specify the list form of the macro. Use the list form together with the execute form of the macro for applications that require reentrant code. The list form defines an area of storage that the execute form uses to store the parameters. Only the PLISTVER parameter may be coded with the list form of the macro.
Use MF=E to specify the execute form of the macro. Use the execute form together with the list form of the macro for applications that require reentrant code. The execute form of the macro stores the parameters into the storage area defined by the list form, and generates the macro invocation to transfer control to the service.
IEAMSCHD might abnormally end with system completion code AC7. See z/OS MVS System Codes for an explanation and programmer responses for this code.
When the IEAMSCHD macro returns control to your program, GPR 15 contains a return code.
Hexadecimal Return Code | Meaning |
---|---|
00 | Meaning: Successful completion. |
04 | Meaning: Warning. The enclave token is not valid. The enclave token specified on the ENCLAVETOKEN parameter has been reused for a new enclave. The SRB was not scheduled. |
08 | Meaning: Program error. The client STOKEN address space has failed. The SRB was not scheduled. |
0C | Meaning: Program error. The purge STOKEN address space has failed. The SRB was not scheduled. |
10 | Meaning: Program error. The target STOKEN address space has failed. The SRB was not scheduled. |
1C | Meaning: Program error. A SYNCH=YES SRB was not scheduled or did not complete successfully. This is set only if the SYNCHCOMPADDR parameter is used with an operand that is not NOVALUE and does not indicate that location 0 is to be where data is returned. The values returned on SYNCHCOMPADDR, SYNCHCODEADDR, and SYNCHRSNADDR contain additional information. |
*
SCHED_SRB_RTN EQU *
IEAMSCHD EPADDR=EP_ADDR,ENV=HOME,PRIORITY=LOCAL
.
.
.
EP_ADDR DC A(SRB_ROUTINE) Address of Entry Point for SRB
*
*
SCHED_SRB_RTN EQU *
IEAMSCHD EPADDR=EP_ADDR,ENV=FULLXM, X
PRIORITY=GLOBAL, X
KEYVALUE=PSW_KEY_0
.
.
.
EP_ADDR DC A(SRB_ROUTINE) Address of Entry Point for SRB
PSW_KEY_0 DC X'00' PSW Key 0
*
*
SCHED_SRB_RTN EQU *
USING PSA,0 Base Prefixed Save Area
*
IEAMSCHD EPADDR=EP_ADDR,FRRADDR=FRR_ADDR, X
KEYVALUE=PSW_KEY_2,PRIORITY=ENCLAVE, X
ENCLAVETOKEN=ENCLAVE_TOKEN, X
MINORPRIORITY=MINOR_PRIORITY, X
RMTRADDR=RMTR_ADDR, X
PURGESTOKEN=PURGE_STOKEN, X
PTCBADDR=PSATOLD, X
LLOCK=YES,ENV=HOME
*
.
.
.
ENCLAVE_TOKEN DS D Enclave Token
PURGE_STOKEN DS D Purge-STOKEN
EP_ADDR DC A(SRB_ROUTINE) SRB Entry Point Address
FRR_ADDR DC A(FRR_ROUTINE) Address of FRR Routine
RMTR_ADDR DC A(RMTR_ROUTINE) RMTR Entry Point Address
MINOR_PRIORITY DC X'00' Lowest Priority in Enclave
PSW_KEY_2 DC X'20' PSW Key 2
TITLE 'PSA -- Prefix Save Area'
IHAPSA
*
SCHED_SRB_RTN EQU *
IEAMSCHD EPADDR=EP_ADDR,ENV=STOKEN, X
TARGETSTOKEN=THEIR_STOKEN, X
PRIORITY=LOCAL
*
.
.
.
THEIR_STOKEN DS D Space Token
EP_ADDR DC A(SRB_ROUTINE) SRB Entry Point Address
Note that in this example, the SRB routine is running in a different address space from the scheduling code. To run an SRB routine in a different address space from the scheduling code, the SRB must be either in a different program that is accessible from the target address space, or in the common storage together with the scheduling code.
*
SCHED_SRB_RTN EQU *
*
EXTRACT TCB_PRIORITY,'S',FIELDS=(PRI)
*
SLR 3,3 Clear register
IC 3,DSP_PRIORITY Get Dispatching Priority
S 3,=F'1' Lower priority by 1
BP SAVE_MINOR_PRIORITY
SLR 3,3 If tasks priority already lowest
* set minor priority to zero.
SAVE_MINOR_PRIORITY EQU *
STC 3,MINOR_PRIORITY Save Minor Priority
IEAMSCHD EPADDR=EP_ADDR X
PRIORITY=PREEMPT,ENV=HOME, X
MINORPRIORITY=MINOR_PRIORITY
*
.
.
EP_ADDR DC A(SRB_ROUTINE) Address of Entry Point for SRB
TCB_PRIORITY DS 0F Priority Field
DS H Place holder
DSP_PRIORITY DS B Current Dispatching Priority
MINOR_PRIORITY DS B Minor Priority for SRB Routine
*
SCHED_SRB_RTN EQU *
*
IEAMSCHD EPADDR=EP_ADDR,PARM=PARM_ADDR, X
FEATURE=CRYPTO,ENV=HOME,PRIORITY=CURRENT
*
.
.
.
EP_ADDR DC A(SRB_ROUTINE) SRB Entry Point Address
PARM_ADDR DC A(PARM_LIST) Pointer to parameter list
*
SCHED_SRB_RTN EQU *
IEAMSCHD EPADDR=EP_ADDR,ENV=STOKEN, X
TARGETSTOKEN=THEIR_STOKEN,PRIORITY=LOCAL, X
SYNCH=YES,SYNCHCOMPADDR=COMPCODE, X
SYNCHCODEADDR=ABENDCODE,SYNCHRSNADDR=REASONCODE
*
.
.
.
THEIR_STOKEN DS D Space Token
EP_ADDR DC A(SRB_ROUTINE) SRB Entry Point Address
COMPCODE DS F
ABENDCODE DS F
REASONCODE DS F
Note that in this example, the SRB routine is running in a different address space from the scheduling code. To run an SRB routine in a different address space from the scheduling code, the SRB routine must be either in a different program that is accessible from the target address space, or in the common storage together with the scheduling code.