Get Environment Variable (QtmhGetEnv) API
The QtmhGetEnv() API allows you to get the value set by the IBM HTTP Server for i server for a particular HTTP environment variable.
Required Parameter Group: | |||
1 | Receiver variable | Output | Char(*) |
2 | Length of receiver variable | Input | Binary(4) |
3 | Length of response | Output | Binary(4) |
4 | Request variable | Input | Char(*) |
5 | Length of request variable | Input | Binary(4) |
6 | Error Code | I/O | Char(*) |
Required parameter group
- Receiver variable
- OUTPUT:CHAR(*)
The output variable that contains the value set by the server for the requested environment variable. In CGI input mode %%MIXED%%, this value will be in CCSID 37; otherwise, it will be in the CCSID of the current job. Note that the QUERY_STRING in %%BINARY%% mode is not converted by the server.
- Length of receiver variable
- INPUT:BINARY(4)
The input variable containing the length of the space provided to receive the environment variable value.
- Length of response
- OUTPUT:BINARY(4)
The output variable that contains the length of the environment variable value. When the API is unable to determine the value for the requested environment variable, the length of the environment variable value is set to zero. When the size required for the environment variable value is larger than the length of the receiver variable, the size required to receive the value is returned.
- Request variable
- INPUT:CHAR(*)
The input variable containing the desired environment variable name.
- Length of request variable
- INPUT:BINARY(4)
The input variable containing the length (without trailing blanks) of the desired environment variable name.
- Error Code
- I/O:CHAR(*)
The structure in which to return error information. For the format of the structure and for details on how to process API errors, see the API error reporting topic in the IBM i Information Center.
Error messages
- CPF24B4 E
- Severe Error while addressing parameter list.
- CPF3C17 E
- Error occurred with input data parameter.
- CPF3C19 E
- Error occurred with receiver variable specified.
- CPF3CF1 E
- Error code parameter not valid.
Programs that need CCSID conversion support for environment variables should use the Get environment variable with CCSID (QzsrGetEnvCCSID) API.