BPX1GET (w_getipc) example

The following code retrieves information on the first semaphore defined to the system to which the caller has read access. For the callable service, see w_getipc (BPX1GET, BPX4GET) — Query interprocess communications. For the data structure, see BPXYIPCQ — Map w_getipc structure. AMODE 64 callers use BPX4GET (w_getipc) example.
                                              
         XC    TOKEN,TOKEN           Zero, token for 1st member         
         LA    R5,BUFFERA            Area for query IPC return data     
         ST    R5,BUFA               R5 -> IPCQ                         
         SPACE ,                                                        
         CALL  BPX1GET,              Interprocess Communications       +
               (TOKEN,               Input: member token               +
               BUFA,                 Input: ->IPCQ             BPXYIPCQ+
               =A(IPCQ#LENGTH),      Input: Length of IPCQ     BPXYIPCQ+
               =A(IPCQ#SEM),         Input: Request            BPXYIPCQ+
               RETVAL,               Return value: 0, -1 or value      +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               VL,MF=(E,PLIST)       ---------------------------------- 
         SPACE ,                                                        
         L     R15,RETVAL            Load return value                  
         C     R15,=F'-1'            Test for -1 return                 
         BE    PSEUDO                Branch on error                    
         LTR   R15,R15               Test for 0 return                  
         BZ    PSEUDO                Branch on end of file              
         ST    R15,TOKEN             Save token for next w_semipc