BPX4HST (gethostid or gethostname) example

The following code requests the host id and the host name for an AF_INET domain. For the callable service, see gethostid or gethostname (BPX1HST, BPX4HST) — Get ID or name information about a socket host. For the data structure, see BPXYSOCK — Map SOCKADDR structure and constants. AMODE 31 callers use BPX1HST (gethostid or gethostname) example.
                                              
         XC    BUFLENA,BUFLENA                                          
         CALL  BPX4HST,              Request host id                   +
               (=A(AF_INET),         Input: Domain - AF_INET           +
               BUFLENA,              Input: Length - No buffer - get id+
               BUFFERA,              Output: (not used with Length=0)  +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ---------------------------------- 
                                              
         MVC   BUFLENA,=A(L'BUFFERA)                                    
         CALL  BPX4HST,              Request host name                 +
               (=A(AF_INET),         Input: Domain - AF_INET           +
               BUFLENA,              Input: Length - for output name   +
               BUFFERA,              Output: Buffer for host name      +
               RETVAL,               Return value: 0 or -1             +
               RETCODE,              Return code                       +
               RSNCODE),             Reason code                       +
               MF=(E,PLIST)          ----------------------------------