Env$: Difference between revisions
No edit summary |
No edit summary |
||
Line 34: | Line 34: | ||
There is a BR provided Env$ variable called GUIMODE (case insensitive). It's value is either ON or OFF depending on whether BR is in [[GUIMode|GUI mode]]. System ENV$ variables cannot be set or altered by CONFIG SETENV. Other system Env$ variables will be added. | There is a BR provided Env$ variable called GUIMODE (case insensitive). It's value is either ON or OFF depending on whether BR is in [[GUIMode|GUI mode]]. System ENV$ variables cannot be set or altered by CONFIG SETENV. Other system Env$ variables will be added. | ||
===ENVIRONMENT INTERROGATION=== | |||
ENV$("STATUS [ .sub-keyword ] ... " [, mat config$ [, search-arg] ...] ) | |||
ENV$ returns a string, or in the event that MAT CONFIG$ is provided, ENV$ redimensions and loads it. For a list of valid keywords issue a STATUS ENV command. If an array is specified, it may be followed by one or more case insensitive substrings which are regarded as restricting search arguments. For example: | |||
ENV$("SERVER_PLATFORM") | |||
returns “WINDOWS” | |||
The following program displays all STATUS information that contains the word “file”: | |||
00100 dim CONFIG$(1)*100 | |||
00120 let ENV$("STATUS",MAT CONFIG$,"file") | |||
00140 print MAT CONFIG$ | |||
The above program produces the following output: | |||
CHAINDFLT - Look for object files with source first. | |||
EDITOR C:\PROGRAM FILES\MILLS ENTERPRISE\MYEDITBR\MYEDITBR.EXE | |||
FILENAMES LOWER_CASE | |||
OPTION 23 is OFF - prevent data conversion errors from moving file position | |||
OPTION 25 is ON - make FILE$(0) be CON: if in windows | |||
OPTION 26 is OFF - suppress creation of .BAK files | |||
OPTION 29 is ON - save programs as .WB files | |||
OPTION 33 is 64 - locking position for large file support | |||
OPTION 49 is OFF - use relative path for spool file | |||
OPTION 51 is OFF - recover deleted records for all files | |||
SPOOLCMD prt.bat [SPOOLFILE] [COPIES] [PRINTER] | |||
Server File: :c:\wbserver.dat | |||
BR Config File: :C:\ADS\SYS\br.d\brconfig.sys | |||
Executable File: :C:\ADS\SYS\br.d\ | |||
brserver-430beta+q-Win32-DebugEfence-2011-03-20.exe | |||
Serial File: :C:\ADS\SYS\br.d\brserial.dat | |||
Workfile path: :c:\ads | |||
Open File # 0 :CON: | |||
If you just want the options with the word file then use: | |||
00100 dim CONFIG$(1)*100 | |||
00120 let ENV$("STATUS.CONFIG.OPTION",MAT CONFIG$,"file") | |||
00140 print MAT CONFIG$ | |||
Which produces: | |||
OPTION 23 is OFF - prevent data conversion errors from moving file position | |||
OPTION 25 is ON - make FILE$(0) be CON: if in windows | |||
OPTION 26 is OFF - suppress creation of .BAK files | |||
OPTION 29 is ON - save programs as .WB files | |||
OPTION 33 is 64 - locking position for large file support | |||
OPTION 49 is OFF - use relative path for spool file | |||
OPTION 51 is OFF - recover deleted records for all files | |||
Note that while keywords are case insensitive, they must be correctly specified, whereas search arguments are more “friendly”. For a complete list of valid keywords, issue the command: | |||
STATUS ENV -p | |||
Some of the new keywords supported are: | |||
ENV$("CLIENT_PLATFORM") is "WINDOWS" | |||
ENV$("CLIENT_PLATFORM.BR_BUILD_TYPE") is "DebugEfence" | |||
ENV$("CLIENT_PLATFORM.BR_BUILD_DATE") is "2011-05-12" | |||
ENV$("CLIENT_PLATFORM.BR_BITS") is "32" | |||
ENV$("CLIENT_PLATFORM.OS_BITS") is "64" | |||
ENV$("CLIENT_PLATFORM.OS_VERSION_NAME") is "Windows 7" | |||
ENV$("CLIENT_PLATFORM.OS_VERSION_NUMBER") is "6.1" | |||
ENV$("SERVER_PLATFORM") is "LINUX" | |||
ENV$("SERVER_PLATFORM.BR_BUILD_TYPE") is "DebugEfence" | |||
ENV$("SERVER_PLATFORM.BR_BUILD_DATE") is "2011-05-13" | |||
ENV$("SERVER_PLATFORM.BR_BITS") is "64" | |||
ENV$("SERVER_PLATFORM.OS_BITS") is "" | |||
ENV$("SERVER_PLATFORM.OS_VERSION_NAME") is "#36-Ubuntu SMP Thu Jun 3 20:38:33 UTC 2010" | |||
ENV$("SERVER_PLATFORM.OS_VERSION_NUMBER") is "2.6.32-22-server" | |||
BR_MODEL “CLIENT/SERVER” or “COMBINED” | |||
<noinclude> | <noinclude> | ||
[[Category: Internal Functions]] | [[Category: Internal Functions]] | ||
</noinclude> | </noinclude> |
Revision as of 18:37, 19 September 2014
ENV$(<variable>)
The Env$(var$) returns the current value of the environment variable. The Env$ function can be used to obtain the value of any user-created or system-created environment variable that can be displayed with the operating system's SET (or set) command. To see a list of these variables, enter the SET command with no parameters at the operating system prompt.
The Env$ function is used to retrieve an environmental variable's value which was set with SetEnv or inherited from Windows' environmental variables.
Example:
got1$=env$("UserName") got2$=env$("GUIMode")
Additionally the status command showing all set environmental variables is:
Status Env
The Env$ internal function can be set by CONFIG SETENV. For example, use the following command to set the value of env$("librarypath"):
config setenv librarypath f:\apps\library\
Operating system ENV$ variables cannot be set or altered by CONFIG SETENV. Other system Env$ variables will be added.
Comments and Examples
As an example, if LOGNAME contains the login name, the following line in a menu program would require a user to log in as "root" to be able to run program PROG14.
00040 if env$("LogName")="root" then chain "Prog14" else goto SHOWMENU
Technical Considerations
- Unix / Linux versions of Business Rules require that user-created environment variables be passed by an export command to the operating system before the user enters Business Rules . Otherwise, the values of these variables cannot be returned by ENV$.
Env$("GUIMode")
There is a BR provided Env$ variable called GUIMODE (case insensitive). It's value is either ON or OFF depending on whether BR is in GUI mode. System ENV$ variables cannot be set or altered by CONFIG SETENV. Other system Env$ variables will be added.
ENVIRONMENT INTERROGATION
ENV$("STATUS [ .sub-keyword ] ... " [, mat config$ [, search-arg] ...] )
ENV$ returns a string, or in the event that MAT CONFIG$ is provided, ENV$ redimensions and loads it. For a list of valid keywords issue a STATUS ENV command. If an array is specified, it may be followed by one or more case insensitive substrings which are regarded as restricting search arguments. For example:
ENV$("SERVER_PLATFORM")
returns “WINDOWS”
The following program displays all STATUS information that contains the word “file”:
00100 dim CONFIG$(1)*100 00120 let ENV$("STATUS",MAT CONFIG$,"file") 00140 print MAT CONFIG$
The above program produces the following output:
CHAINDFLT - Look for object files with source first. EDITOR C:\PROGRAM FILES\MILLS ENTERPRISE\MYEDITBR\MYEDITBR.EXE FILENAMES LOWER_CASE OPTION 23 is OFF - prevent data conversion errors from moving file position OPTION 25 is ON - make FILE$(0) be CON: if in windows OPTION 26 is OFF - suppress creation of .BAK files OPTION 29 is ON - save programs as .WB files OPTION 33 is 64 - locking position for large file support OPTION 49 is OFF - use relative path for spool file OPTION 51 is OFF - recover deleted records for all files SPOOLCMD prt.bat [SPOOLFILE] [COPIES] [PRINTER] Server File: :c:\wbserver.dat BR Config File: :C:\ADS\SYS\br.d\brconfig.sys Executable File: :C:\ADS\SYS\br.d\ brserver-430beta+q-Win32-DebugEfence-2011-03-20.exe Serial File: :C:\ADS\SYS\br.d\brserial.dat Workfile path: :c:\ads Open File # 0 :CON:
If you just want the options with the word file then use:
00100 dim CONFIG$(1)*100 00120 let ENV$("STATUS.CONFIG.OPTION",MAT CONFIG$,"file") 00140 print MAT CONFIG$
Which produces:
OPTION 23 is OFF - prevent data conversion errors from moving file position OPTION 25 is ON - make FILE$(0) be CON: if in windows OPTION 26 is OFF - suppress creation of .BAK files OPTION 29 is ON - save programs as .WB files OPTION 33 is 64 - locking position for large file support OPTION 49 is OFF - use relative path for spool file OPTION 51 is OFF - recover deleted records for all files
Note that while keywords are case insensitive, they must be correctly specified, whereas search arguments are more “friendly”. For a complete list of valid keywords, issue the command:
STATUS ENV -p
Some of the new keywords supported are:
ENV$("CLIENT_PLATFORM") is "WINDOWS" ENV$("CLIENT_PLATFORM.BR_BUILD_TYPE") is "DebugEfence" ENV$("CLIENT_PLATFORM.BR_BUILD_DATE") is "2011-05-12" ENV$("CLIENT_PLATFORM.BR_BITS") is "32" ENV$("CLIENT_PLATFORM.OS_BITS") is "64" ENV$("CLIENT_PLATFORM.OS_VERSION_NAME") is "Windows 7" ENV$("CLIENT_PLATFORM.OS_VERSION_NUMBER") is "6.1" ENV$("SERVER_PLATFORM") is "LINUX" ENV$("SERVER_PLATFORM.BR_BUILD_TYPE") is "DebugEfence" ENV$("SERVER_PLATFORM.BR_BUILD_DATE") is "2011-05-13" ENV$("SERVER_PLATFORM.BR_BITS") is "64" ENV$("SERVER_PLATFORM.OS_BITS") is "" ENV$("SERVER_PLATFORM.OS_VERSION_NAME") is "#36-Ubuntu SMP Thu Jun 3 20:38:33 UTC 2010" ENV$("SERVER_PLATFORM.OS_VERSION_NUMBER") is "2.6.32-22-server" BR_MODEL “CLIENT/SERVER” or “COMBINED”