z/OS UNIX hostname: Identify the local host

Use the z/OS UNIX hostname command to display the fully qualified DNS host name of the local system.

Format

Read syntax diagramSkip visual syntax diagram
               .----------------------.     
               V .- - c ------------. |     
>>-hostname--+---+------------------+-+-+----------------------><
             |   |       (1)        |   |   
             |   +- - c ------------+   |   
             |   |       (1)        |   |   
             |   +- - g ------------+   |   
             |   |       (1)        |   |   
             |   +- - r ------------+   |   
             |   +- - s ------------+   |   
             |   +- - p --stackname-+   |   
             |   '- - d ------------'   |   
             +- - h --------------------+   
             '- - ? --------------------'   

Notes:
  1. Only one of the -c, -g, and -r parameters can be specified.

Parameters

-c
Uses the TCPIP.DATA configuration (this is the default).

Specifies the fully qualified host name (the host name with its appended domain name). The host name is obtained with the __iphost() function call. The host name portion of the displayed name is the value of the z/OS® UNIX user's TCPIP.DATA HOSTNAME statement. The domain name portion of the displayed name is the value of the z/OS UNIX user's TCPIP.DATA DomainOrigin statement or the first domain name that is specified by the SEARCH statement.

-g
Uses gethostname() result.

Specifies the host name without the domain name. The host name is obtained by using the gethostname() function call. The displayed name is the value of the TCPIP.DATA HOSTNAME statement for the TCP/IP stack.

-r
Uses DNS lookup on gethostname() result.

Specifies the fully qualified host name (the host name that is returned by a gethostname() function call), apppended with the domain name. The returned host name is the value of the TCPIP.DATA HOSTNAME statement for theTCP/IP stack. The gethostbyname() call uses the TCPIP.DATA resolver statements of the z/OS UNIX user to obtain the fully qualified host name. Based on those statements, Domain Name Servers (DNS) and resolver local host tables are used for the name resolution. The displayed name is the result of the name resolution.

-s
Prints the short name of the host (without the DNS domain name).

Specifies the host name without the domain name. The host name is obtained by using the __iphost() function call. The displayed name is the value of the TCPIP.DATA HOSTNAME statement of the z/OS UNIX user.

-p stackname
Uses this AF_INET stack.

Specifies which TCP/IP stack the -g or -r parameter uses for its gethostname() function call.

-d
Prints trace messages for problem diagnosis.
-h
Displays the usage message.
-?
Displays the usage message.