Get environment variable with CCSID (QzsrGetEnvCCSID) API

The QzsrvGetEnvCCSID() API allows a CGI program to get the value set by the server for a particular HTTP environment variable using CCSID support for input and output values.

Required parameter group:
Receiver variable Output Char(*)
Length of receiver variable Input Binary(4)
Length of response Output Binary(4)
Request variable Input Char(*)
Length of request variable Input Binary(4)
CCSID of request variable Input Binary(4)
CCSID of returned environment variable Input Binary(4)
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. This value will be returned in the CCSID specified for the returned environment variable.

The output variable that contains the value set by the server for the requested environment variable. This value will be returned in the CCSID specified for the returned environment variable.

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 QzsrvGetEnvCCSID() 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.

CCSID of request variable
INPUT:BINARY(4)
The CCSID to be used for the encoding of the request variable. The valid values for this parameter are:
  • 0 : The CCSID of the job.
  • 1-65533 : A valid CCSID in this range must be specified or an error is returned.
CCSID of returned environment variable
INPUT:BINARY(4)
The CCSID to be used for the encoding of the returned environment variable. The valid values for this parameter are:
  • 0 : The CCSID of the job.
  • 1-65533 : A valid CCSID in this range must be specified or an error is returned.
Error code
I/O:CHAR(*)

The structure in which to return error information. Error messages are added to the error log or script log except for those listed below. 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.
CPF3CF1 E
Error code parameter not valid.
Note: The Environment Variable APIs provide the getenv() (Get Value of Environment Variable) function necessary to retrieve environment variables in ILE C. Programs that need CCSID conversion support for environment variables should use the Get environment variable with CCSID (QzsrGetEnvCCSID) API.