IWC.GetAppCGIValue: Retrieving a WebFOCUS Parameter or Variable

How to:

The IWC.GetAppCGIValue function retrieves the value of a WebFOCUS parameter or variable and imports it into a Maintain Data variable. IWC.GetAppCGIValue returns the value from the HTTP request header if the name of the parameter or variable is passed.

If the passed parameter or variable name is not found, the function returns a null value. Therefore, you can check for errors by looking for a null value, then handle the error as needed.

Both the IWC.FindAppCGIValue and IWC.GetAppCGIValue functions are supported, but it is recommended you use IWC.GetAppCGIValue. This function allows the parameter or variable value to be directly assigned to a Maintain Data variable, while IWC.FindAppCGIValue does not.

Note: Unlike Maintain Data variables, WebFOCUS parameters and variables are case-sensitive.

Syntax: How to Retrieve a WebFOCUS Parameter

Declare mnt_var/type_length = IWC.GetAppCGIValue(parm);

where:

mnt_var

Is the Maintain Data variable that receives the ASCII return value of the WebFOCUS parameter or variable. The value is unescaped before being passed to the Maintain Data variable.

type_length

Is the selected type and length format of the Maintain Data variable.

parm

Is the WebFOCUS parameter or variable to import. This value is case-sensitive.

Example: Retrieving a WebFOCUS Parameter

IWC.getAppCGIValue retrieves the PRODUCT_ID WebFOCUS parameter:

Maintain File GGPRODS
Infer Product_ID into prodstk;
Declare pcode/a4=IWC.getAppCGIValue("PRODUCT_ID");  
For 1 next Product_ID into prodstk where Product_ID eq pcode;