Example 2

Set up and load into storage the ENFLST01 listener user exit routine. This listener user exit routine receives a parameter from the ENF listener when the specified event occurs. The listener user exit runs in the address space of the listener and is deleted when the address space that issued the listen request ends.
* Load ENF Listen Exit (ENFLST01) into storage and save address.
* ENFL01@ contains the address of the listener user exit routine.
*
* Issue LISTEN Request for Event Code 35
         L     R02,ENFL01@
         ENFREQ ACTION=LISTEN,    -- Function                          +
               CODE=ENFC35,       -- Event Code                        +
               SRBEXIT=(R02),     -- Exit Address                      +
               PARM=LPARM,        -- Parameter                         +
               EOT=YES,           -- End-of-task delete indicator      +
               EOM=YES,           -- End-of-memory delete indicator    +
               ESTBNME=THISMOD,   -- Establisher Name                  +
               EXITNME=ENFLST01,  -- Exit Name                         +
               DTOKEN=ENFL01T     -- Returned Token Field
*
* Check the return code from ENFREQ - if not zero issue message
*
* - Local variables
DATAAREA DSECT
ENFL01@  DS    A
ENFL01T  DS    F
ENFPTR   DS    A
LPARM    DS    CL16
*
* - Local constants
ENFLSTEN CSECT
         DS    0F
ENFC35   EQU   35
THISMOD  DC    CL8'ENFLSTEN'
ENFLST01 DC    CL8'ENFLST01'
*
* - External control blocks
         CVT   DSECT=YES
         IEFENFCT
ENFLSTEN CSECT
         IXCYENF
DATAAREA DSECT
         IEFENFPM
LENODATA EQU   *-DATAAREA
*