Retrieving Environment Variables
The following is an RPG example of how to retrieve environment variables:
Fixed Format
Ā Ā Ā Ā D getenvĀ Ā Ā Ā Ā Ā Ā Ā Ā PRĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā *Ā Ā ExtProc('getenv')
Ā Ā Ā Ā DĀ Ā nameĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā *Ā Ā Value Options(*String)
D varptr s *
Ā Ā Ā Ā D ipaddressĀ Ā Ā Ā Ā Ā sĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā 25A
Ā Ā Ā Ā Ā /Free
varptr = getenv('REMOTE_ADDR');
if varptr = *null;
// no REMOTE_ADDR was set
else;
Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā ipaddress = %str(varptr);
endif;
**FREE
DCL-PR GETENV POINTER EXTPROC('getenv');
NAME POINTER VALUE OPTIONS(*STRING);
END-PR;
DCL-S IPADDRESS CHAR(25);
DCL-S VARPTR POINTER;Ā
VARPTR = GETENV('REMOTE_ADDR');
IF (VARPTR = *NULL);
// No REMOTE_ADDR was set.
ELSE;
IPADDRESS = %STR(VARPTR);
ENDIF;
Environment variables set by Profound UI include:
PROFOUNDUI = Always set to '1' if running in the Profound UI session controller.
PUI_LANG = language ID that Profound UI is using (see International Language Support (Translations) for details)
Environment variables set in the HTTP server configuration using theĀ SetEnv directive are also available, as are the environment variables set by the HTTP server. See documentationĀ here.
If you are using Genie, you must run theĀ PUISETENV utility to set the environment variables in the job.