BPX4BND (bind) example

The following code does a bind to associate a name with a socket. SOCKDESC was previously set by a call to BPX4SOC. For the callable service, see bind (BPX1BND, BPX4BND) — Bind a unique local name to a socket descriptor. For the data structure, see BPXYSOCK — Map SOCKADDR structure and constants. AMODE 31 callers use BPX1BND (bind) example.
                                              
         SPACE ,                                                        
         MVI   SOCK_LEN,12           Store the length of the address    
         MVI   SOCK_FAMILY,AF_UNIX   Set the domain to AF_UNIX          
         MVC   SOCK_SUN_NAME(12),=CL12'/tmp/socket1'  Set the name      
         CALL  BPX4BND,              Bind a name to a socket           +
               (SOCKDESC,            Input: Socket Descriptor          +
               =A(SOCK#LEN+SOCK_SUN#LEN), Input: Length - Sockaddr     +
               SOCKADDR,             Input: Sockaddr structure         +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ----------------------------------