BPX2RMS (recvmsg) example

The following code issues a recvmsg for a socket. SOCKDESC was returned from a previous call to either BPX1SOC or BPX1ACP. For the callable service, see recvmsg (BPX2RMS, BPX4RMS) — Receive messages on a socket and store them in message buffers. For the data structures, see BPXYSOCK — Map SOCKADDR structure and constants, BPXYMSGF — Map the message flags, BPXYMSGH — Map the message header, and BPXYIOV — Map the I/O vector structure. AMODE 64 callers use BPX4RMS (recvmsg) example.
                                              
         SPACE ,                                                        
         XC    MSGH(MSGH#LENGTH),MSGH  Clear msgh                       
         LA    R2,SOCKADDR                                              
         ST    R2,MSGHNAMEPTR        Store the address of sockaddr      
         LA    R2,SOCK#LEN+SOCK_SUN#LEN                                 
         ST    R2,MSGHNAMELEN                                           
         LA    R2,IOV                                                   
         ST    R2,MSGHIOVPTR                                            
         MVI   MSGHIOVNUM,1                                             
         LA    R2,BUFFERA                                               
         ST    R2,IOV_BASE                                              
         LA    R2,L'BUFFERA                                             
         ST    R2,IOV_LEN                                               
*                                                                       
         CALL  BPX2RMS,              Receive a message from a socket   +
               (SOCKDESC,            Input: Socket Descriptor          +
               MSGH,                 Input: Address of BPXYMSGH        +
               MSG_FLAGS,            Input: Flags                      +
               PRIMARYALET,          Input: Alet of the iov            +
               PRIMARYALET,          Input: Alet of the buffers in iov +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               VL,MF=(E,PLIST)       ----------------------------------