GETHOSTNAME

The GETHOSTNAME macro returns the name of the host processor on which the program is running. As many as NAMELEN characters are copied into the NAME field.
Note: The host name that is returned is the host name the TCPIP stack learned at startup from the TCPIP.DATA file that was found. For more information about host name, see HOSTNAME statement in z/OS Communications Server: IP Configuration Reference.
The following requirements apply to this call:
Read syntax diagramSkip visual syntax diagram
>>-EZASMI--TYPE=GETHOSTNAME--,NAMELEN--=--+-address--+---------->
                                          +-*indaddr-+   
                                          '-(reg)----'   

>--,NAME--=--+-address--+--,ERRNO--=--+-address--+-------------->
             +-*indaddr-+             +-*indaddr-+   
             '-(reg)----'             '-(reg)----'   

>--,RETCODE--=--+-address--+--+---------------------------+----->
                +-*indaddr-+  +-,ECB--=--+-address--+-----+   
                '-(reg)----'  |          +-*indaddr-+     |   
                              |          '-(reg)----'     |   
                              '-,REQAREA--=--+-address--+-'   
                                             +-*indaddr-+     
                                             '-(reg)----'     

>--+-------------------------+--+------------------------+-----><
   '-,ERROR--=--+-address--+-'  '-,TASK--=--+-address--+-'   
                +-*indaddr-+                +-*indaddr-+     
                '-(reg)----'                '-(reg)----'     

Keyword
Description
NAMELEN
Input parameter. A fullword set to a value or the address of a fullword binary field set to the length of the name field. The minimum length of the NAME field is 1 character. The maximum length of the NAME field is 255 characters.
NAME
The application provides a pointer to a receiving field for the host name. If the host name is shorter than the NAMELEN value, the NAME field is filled with binary zeros after the host name. If the host name is longer than the NAMELEN value, the name is truncated.
ERRNO
Output parameter. A fullword binary field. If RETCODE is negative, ERRNO contains a valid error number. Otherwise, ignore ERRNO.

See Socket call error return codes for information about ERRNO return codes.

RETCODE
Output parameter. A fullword binary field that returns one of the following values:
Value
Description
0
Successful call.
-1
An error occurred.
ECB or REQAREA
Input parameter. This parameter is required if you are using APITYPE=3. It points to a 104-byte field containing:
For ECB
A 4-byte ECB posted by TCP/IP when the macro completes.
For REQAREA
A 4-byte user token (set by you) that is presented to your exit when the response to this function request is complete.
For ECB/REQAREA
The last 100 bytes is a storage field used by the interface to save the state information.
Note: This storage must not be modified until the macro function has completed and the ECB has been posted, or the asynchronous exit has been driven.
ERROR
Input parameter. The location in your program to receive control when the application programming interface (API) processing module cannot be loaded.
TASK
Input parameter. The location of the task storage area in your program.