Detecting Genie Mode

Detecting Genie Mode

Overview

Profound UI provides a simple method to allow your programs to determine if the programs are running in Genie vs. a traditional 5250 environment. This is accomplished by either calling the program PUISETENV or running the CL command PUISETENV. These objects are located in the Profound UI product installation library, which is PROFOUNDUI by default.

The program returns a flag, isGenie, that is set to “1” (*On) or “0” (*Off) to indicate whether or not the current job is a Genie session. If the job is a Genie session, the following are (optionally) returned: Genie library, Genie skin name, HTTP server document root directory, HTTP user agent string, HTTP server IP address, and HTTP request identifier. 

Below is the RPG prototype for calling this program:

D PUISETENV PR ExtPgm('PUISETENV') D isGenie N Options(*NoPass) D GenieLib 10A Options(*NoPass) D GenieSkin 50A Options(*NoPass) D DocRoot 128A Options(*NoPass) D UserAgent 128A Options(*NoPass) D ServerIP 15A Options(*NoPass) D SetHTTPVars 1A Options(*NoPass) D RequestId 100A Options(*NoPass)

The SetHTTPVars and RequestId parameters were added in Profound UI Version 6, Fix Pack 30.0.

The CL command does not accept any parameters.

After calling either the program or CL command in the job, the following environment variables will be set if the job is a Genie session:

  • PUI_IS_GENIE - Set to "1" and can be used as an alternative to the isGenie program parameter; 

  • PUI_SESSION_ID - Set to the unique Profound UI / Genie session id;

  • If the SetHTTPVars parameter is not passed or is set to “1”:

    • Any environment variables set with SetEnv directives in the following HTTP server configuration file: /www/HTTP_SERVER_INSTANCE_NAME/conf/httpd.conf

  • Any environment variables set by the HTTP server itself, as documented here.

If the job is not a Genie session, no environment variables will be set by the program or command.

Environment variables can be retrieved based on the information found here.

Backwards Compatibility

For backwards compatibility purposes, a duplicate of the PUISETENV program named PUI0002300 is supplied and can be used.