BPX4QSN (msgsnd) example

The following code adds a message to the message queue identified by MSG_ID. For the callable service, see msgsnd (BPX1QSN, BPX4QSN) — Send to a message queue. For the data structure, see BPXYMSG — Map interprocess communication message queues. AMODE 31 callers use BPX1QSN (msgsnd) example.
                                              
         LA    R15,BUFFERA           R15 -> Utility buffer              
         STG   R15,BUFA                                                 
         USING MSGBUF,R15                                               
         MVC   MSG_TYPE(4),=A(0)                                        
         MVC   MSG_MTEXT(11),=CL11'QSN MSG TEXT'                        
         MVC   BUFLENA(4),=A(15)                                        
         MVC   FLAGS(4),=A(IPC_NOWAIT)   Don't wait on queue full       
         DROP  R15                                                      
         SPACE ,                                                        
         CALL  BPX4QSN,              Send a message (msgsnd)           +
               (MSG_ID,              Input: MessageQueueID             +
               BUFA,                 Input: ->MSGBUF           BPXYMSG +
               PRIMARYALET,          Input: ALET of message buffer     +
               BUFLENA,              Input: Length MSGBUF              +
               FLAGS,                Input: Flags              BPXYIPC +
               RETVAL,               Return value: 0, -1               +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ----------------------------------