SQL iQuery Script Built-in Function

Index

Is iQuery Running in a CGI/Web Environment?

IsWeb / IsWebEnv

The ISWEB() built-in functions returns true if the SQL iQuery Script was evoked from the CGI Environment. This setting is established when the WEBIQRY program is used as the CGI program from an HTML page or other HTTP interface.

Syntax

The ISWEB built-in function checks if the iq_WEBIQRY environment variable exists. If it does, it returns true otherwise it returns false. 3rd-party apps that are called via CGI instead of our WEBIQRY can set the the iq_WEBIQRY environment variable so that iQuery Scripts can detect the CGI interface if needed. To do that, use the putenv() C runtime function or any of the several other IBM i API functions that set an environment variable value. ISWEB() only checks to see if the variable exists, it does not check its assigned value.

Parameters

This built-in function has no parameters.


if IsWeb();
#HTTP_OUTPUT JSON
else;
#OUTPUT EXCEL
endif;

The above script checks if running as a CGI/Web application, if so, it sets the HTTP output response to the JSON format. Otherwise it sets the output format to Excel.