BPX4MGT (shmget) example

The following code creates a private shared memory segment of 500 bytes. For the callable service, see shmget (BPX1MGT, BPX4MGT) — Create/find a shared memory segment. For the data structure, see BPXYSEM — Map interprocess communication semaphores. AMODE 31 callers use BPX1MGT (shmget) 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          
         SPACE ,                                                        
         CALL  BPX4MGT,              Create a set of semaphores        +
               (KEY,                 Input: Shared memory segment KEY  +
               =AD(500),             Input: Segment size               +
               S_MODE,               Input: Creation flags     BPXYIPC +
               RETVAL,               Return value: -1 or MessageQue ID +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ---------------------------------- 
         SPACE ,                                                        
         ICM   R15,B'1111',RETVAL    Test return value                  
         BNP   PSEUDO                Branch on shmget failure           
         ST    R15,SHM_ID            Store SHM_ID associated with key