Giovanni's logo
Live example of retrieving environment variables
this means Version 2
blue line
Here are some of the environment variables from your AS/400 HTTP server, as they are returned to the CGI program issuing this page.

QtmhGetEnv API provides information about the following environment variables:
(for a complete list of the environment variables set by the HTTP Server, see this page)
Environment variable Meaning
Current value
AUTH_TYPE If the server supports client authentication and the script is a protected script, this environment variable contains the method that is used to authenticate the client. For example: Basic
Not available
CGI_ASCII_CCSID Contains the ASCII CCSID the server used when converting CGI input data. If the server did not perform any conversion, (for example, in %%BINARY%% mode), the server sets this value to the DefaultNetCCSID configuration directive value
CGI_MODE Contains the CGI conversion mode the server is using for this request. Valid values are %%EBCDIC%%, %%MIXED%%, %%BINARY%%, or %%EBCDIC_JCD%% (for more information, see HTTP Server for AS/400 Webmaster's Guide). The program can use this information to determine what conversion, if any, was performed by the server on CGI input data and what format that data is currently in
CGI_EBCDIC_CCSID Contains the EBCDIC CCSID under which the current server job is running (DefaultFsCCSID configuration directive). It also represents the current job CCSID that is used during server conversion (if any) of CGI input data
CONTENT_LENGTH When the method of POST is used to send information, this variable contains the number of characters. Servers typically do not send an end-of-file flag when they forward the information by using stdin. If needed, you can use the CONTENT_LENGTH value to determine the end of the input string. For example: 7034
CONTENT_TYPE When information is sent with the method of POST, this variable contains the type of data included. You can create your own content type in the server configuration file and map it to a viewer. For example: Application/x-www-form-urlencoded
Not available
GATEWAY_INTERFACE The version of the CGI specification with which the server complies. Format: CGI/revision
HTTP_ACCEPT MIME content types the browser will accept.
HTTP_COOKIE All the cookies available to the current page.
Not available
HTTP_HOST Contains the HTTP host URL.
HTTP_REFERER Reference to the page or frame the current page or frame was linked from
Not available
HTTP_USER_AGENT String identifying the Web client. Includes name and version of the browser, request made through a proxy, and other information
CCBot/2.0 (
IBM_CCSID_VALUE the CCSID under which the current server job is running
PATH_INFO The extra path information following the path information required to identify the CGI program name
Not available
PATH_TRANSLATED The server provides a translated version of PATH_INFO, which takes the path and does any virtual-to-physical mapping to it
Not available
QUERY_STRING Anything that follows the first ? in the request URL. The string is encoded in the standard URL format of changing spaces to '+" and encoding special characters with '%xx' hexadecimal encoding
REMOTE_ADDR The IP address of the remote host making the request
REMOTE_HOST The hostname making the request
Not available
REMOTE_IDENT User ID of the remote user
Not available
REQUEST_METHOD The method with which the request was made. For HTTP, this is GET or POST
REMOTE_USER User name passed for authentication
Not available
SCRIPT_NAME A virtual path to the program being executed, used for self-referencing URLs
SERVER_ADDR The server's IP address
SERVER_NAME The server's hostname, DNS alias, or IP address as it would appear in self-referencing URLs
SERVER_PORT The port number to which the request was sent
SERVER_PROTOCOL The name and revision of the information protocol this request came in with. Format: protocol/revision
SERVER_SOFTWARE The name and version of the information server software answering the request (and running the gateway). Format: name/version.
For example:
IBM-Secure-ICS/AS/400 Secure HTTP Server

Please note that the CGI program issuing this page, whenever an environment variable value is blank, will display it as Not available, with the exception of the environment variable QUERY_STRING .

Click here to browse the source of the RPG CGI program issuing this page.