You cannot use the "environment variables" BEGINLIBPATH and ENDLIBPATH
(OS/2 Version 3.0 and above) in a REXX program because these are not
real environment variables.
Statements like
say " BeginLibPath=<" || value( "BEGINLIBPATH " ,, "OS2ENVIRONMENT") || ">" say " EndLibPath=<" || value( "ENDLIBPATH " ,, "OS2ENVIRONMENT") || ">"
will always return
BeginLibPath=<> EndLibPath=<>
To set the "variable" BEGINLIBPATH in a REXX program you must use the OS/2 command SET:
"SET BEGINLIBPATH=C:\MYLIBS"
If you try to modify BEGINLIBPATH/ENDLIBPATH with the SET command AND with the REXX function VALUE at the same time, OS/2 produces a strange result:
It creates two variables, both named BEGINLIBPATH (The correct variable
is the variable with the blanks before and after the equal sign.).
The environment variable BEGINLIBPATH set with the REXX function
VALUE is only accessible with %BEGINLIBPATH% - the REXX function
VALUE can&t read the environment variable.
To equalize this the CMD.EXE can't read the "variable" set with the SET
command anymore if there's an environment variable set with the REXX function
VALUE.
By the way: If you want to use the value of the "variable" BEGINLIBPATH
set with the SET command in other OS/2 commands with %BEGINLIBPATH%
you must write the name complete in uppercase. But, of course,
there's also an exception to this rule:
If you want to change the variable BEGINLIBPATH with a command like
SET BEGINLIBPATH=%BEGINLIBPATH%;C:\newPart you can write BEGINLIBPATH
in lowercase or mixed case also.
Additional note: The CMD.EXE does some validation for the value for BEGINLIBPATH - a value for this variable is only accepted if all parts of the value (separated with a semicolon ;) contain at least one : or \. An invalid part of the value and all parts behind the invalid part are ignored. And last: the maximum length for BEGINLIBPATH is 1024 characters.
Before I forget: The described behavior is also true for ENDLIBPATH -- at least one rule without an exception.
Last note: BEGINLIBPATH and ENDLIBPATH are not supported by 4OS2 until version 2.5a. JP Software recommends to use aliase like
BEGINLIBPATH=d:\path\cmd /c beginlibpath ENDLIBPATH=d:\path\cmd /c endlibpath
if you really want to use them in 4OS2 version 2.5a. In 4OS/2 version 2.51b, JP Software has fixed the problems that 4OS/2 was having with BEGINLIBPATH/ENDLIBPATH..
see also Detecting the LIBPATH
values