Sample program for subscribing to OM

This REXX SPOC API sample program uses CSLULSUB, CSLULBGUM, and CSLULUSB to subscribe to OM and to retrieve unsolicited messages. The program shows how you can invoke unsolicited output message functions.

/* rexx */
/*-------------------------------------------------------------
| REXX SPOC API example to invoke unsolicited output message  |
| functions.                                                  |
-------------------------------------------------------------*/

/*-------------------------------------------------------------
| tuning parameter: check every 10 seconds                    |
-------------------------------------------------------------*/
interval = 10

/*-------------------------------------------------------------
| We want to make syscalls, that is, sleep                    |
-------------------------------------------------------------*/
Call syscalls 'ON'

/*-------------------------------------------------------------
|  Establish IMS rexx environment                             |
-------------------------------------------------------------*/
Address LINK 'CSLULXSB'
If rc = 0 Then
 Do
   Address IMSSPOC
/*-------------------------------------------------------------
|  Subscribe to messages from IMSplex named  'PLEX1'          |
-------------------------------------------------------------*/
   continu = 1
   Do while(continu)
     subrc   = CSLULSUB('PLEX1')
     say 'subrc=('subrc')'
     If subrc = '01000010X' Then
       Do
          Say time()
        Address syscall "sleep" interval
       End
     Else
       continu = 0
   End


   Do a = 1 To 25
/*-------------------------------------------------------------
| wait a little before checking for new messages              |
-------------------------------------------------------------*/
     Address syscall "sleep" interval

/*-------------------------------------------------------------
|  Check if any unsolicited messages are present.             |
-------------------------------------------------------------*/
     results = CSLULGUM('PLEX1','xml.')
     say  'a='a  'results=('results')'

     If xml.0 /= '' Then
       Do
/*-------------------------------------------------------------
|  Display any messages in unsolicited message array.         |
-------------------------------------------------------------*/
         say 'xml.'0' = ('xml.0')'
         Do idx = 1 To  xml.0
           say 'xml.'idx'=('xml.idx')'
         End

       End
   End
/*-------------------------------------------------------------
|  Unsubscribe to unsolicited messages.                       |
-------------------------------------------------------------*/
   usbrc   = CSLULUSB('PLEX1' )

/*-------------------------------------------------------------
|  clean up REXX SPOC API                                     |
-------------------------------------------------------------*/
   "END"
 End
Exit