Example 1

This example shows a scenario of scheduling an SRB using IEAMSCHD and purging the SRB using PURGEDQ. The example schedules an SRB routine:
The scheduling routine's current task recovery is to receive control should the SRB routine's recovery percolate. The SRB routine should be purged if the current task terminates. The ENCLAVE_TOKEN and PURGE_STOKEN were previously initialized.
*
SCHED_SRB_RTN  EQU *
               USING  PSA,0          Base Prefixed Save Area
*
               IEAMSCHD  EPADDR=EP_ADDR,FRRADDR=FRR_ADDR,KEYVALUE=
               PSW_KEY_2,PRIORITY=ENCLAVE,ENCLAVETOKEN=ENCLAVE_TOKEN,
               MINORPRIORITY=MINOR_PRIORITY,RMTRADDR=RMTR_ADDR,
               PURGESTOKEN=PURGE_STOKEN,PTCBADDR=PSATOLD,LLOCK=YES,
               ENV=HOME

*
    .
    .
    .
ENCLAVE_TOKEN  DS    D               Enclave Token returned by IWMECREA
PURGE_STOKEN   DS    D               Purge-STOKEN
EP_ADDR        DC    A(SRB_ROUTINE)  Address of Entry Point for SRB
FRR_ADDR       DC    A(FRR_ROUTINE)  Address of FRR Routine
RMTR_ADDR      DC    A(RMTR_ROUTINE) Address of RMTR Entry Point
MINOR_PRIORITY DC    X'00'           Lowest Priority in Enclave
PSW_KEY_2      DC    X'20'           PSW Key 2