Detecting Genie mode

Profound UI provides a simple method to allow your programs to determine whether they 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, PROFOUNDUI by default.

The program returns a flag 'isGenie' that is set to '1' (*On) or '0' (*Off) to indicate whether/not the current job is Genie session. If the job is a Genie session, the Genie library, Genie skin name, http server document root directory, http user agent string, and HTTP server IP address are optionally returned. The following 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)

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", can be used as an alternative to the "isGenie" program parameter. 

  • PUI_SESSION_ID: Set to the unique Profound UI / Genie session id.

  • Any environment variables set with SetEnv directives in the 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 here.

Backwards Compatibility

For backwards comparability purposes, a duplicate of the PUISETENV program named PUI0002300 is supplied.