BPX4SGT (semget) example

The following code creates a private set of 10 semaphores. For the callable service, see semget (BPX1SGT, BPX4SGT) — Create or find a set of semaphores. For the data structure, see BPXYSEM — Map interprocess communication semaphores. AMODE 31 callers use BPX1SGT (semget) example.
                                              
         MVC   KEY(4),=A(IPC_PRIVATE)  Local to this family             
         MVI   S_TYPE,IPC_CREAT+IPC_EXCL   Must not already exist       
         MVI   S_MODE1,0             Not used                           
         MVI   S_MODE2,S_IRUSR       All read and write permissions     
         MVI   S_MODE3,S_IWUSR+S_IRGRP+S_IWGRP+S_IROTH+S_IWOTH          
         MVC   NUMB_SEMS(4),=A(10)         10 semaphores this set       
         SPACE ,                                                        
         CALL  BPX4SGT,              Create a set of semaphores        +
               (KEY,                 Input: Semaphore key              +
               NUMB_SEMS,            Input: Number semaphores in set   +
               S_MODE,               Input: Flags    BPXYMODE / BPXYIPC+
               RETVAL,               Return value: -1 or Semaphore ID  +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ---------------------------------- 
         SPACE ,                                                        
         ICM   R15,B'1111',RETVAL    Test return value                  
         BNP   PSEUDO                Branch on semget failure           
         ST    R15,SEM_ID            Store SEM_ID associated with key