There are 4 files in this fix, unZIP them to either a diskette or directory. In order to use these files, you will need to either copy them to the ROOT directory of the BOOT drive, and then restart your system, or use the Install diskette and ESC to the A: prompt and replace these files in your OS2\DLL directory. The changes will then take effect when you reboot your system. The files in the ZIP files are - REXX.TXT (this file) REXX.DLL REXXAPI.DLL REXXINIT.DLL REXXUTIL.DLL These contain the fixes for APARs PJ03945 and PJ04178, plus the following REXXUTIL fixes: "The SysIni function doesn't release allocated storage when the 'ALL:' parameter is used." "Stack overflow when Rexx is used from PMREXX" "Cannot close a session when a Rexx program is running" APAR: PJ04178 Title: VALUE FUNCTION RETURNS INCORRECT VALUE Problem Description The following REXX program produces incorrect output : /* */ Stem. = '' Key = 'AAA' KVal = 'BBB' call Test Stem.!AAA = '' call Test exit Test: say say 'This should be null: "'Stem.!AAA'"' Old = value(('Stem.!'Key, KVal) say 'This should be null: "'Old'"' say 'This should be BBB: "'Stem.!AAA'"' return ----------------------------------------------- Initializing Stem. = '' should initialize Stem.!AAA to ''. The first time Test is called, in correct output is produced. ******************** APAR: PJ03945 Title: REXX: VALUE(.."OS2ENVIRONMENT"..) TO SET ENV HOSES PIB INFO. Problem Description "RexxStart()" Bug I use RexxStart() from a "C" program to call a REXX procedure. I have recently diagnosed a problem where if I set an environment variable in this rexx procedure, the called programs environment is corrupted (as a "C" "getenv()" call fails to retrieve a variable that is known to exist. Depending on the change to the environment, I sometimes get an invalid value returned in the "pib_pchcmd" field from a "DosGetInfoBlocks()" call. This invalid value is the tail part of the new variable value. Thinking that the bug may only occur when expanding the size of an environment variable or the environment, I tried to shorten the path variable, this removed the problem with "pib_pchcmd" being corrupted but still caused the "getenv()" to fail. Note that the "getenv()" does not always fail, it obviously depends on the change. REXXUTIL also contains two new REXX WorkPlace Shell functions, SysSetObjectData and SysDestroyObject. See the notes on the REXX WorkPlace Shell functions below. REXX WorkPlace Shell Functions This section contains 4 pieces of information: 1) Large block of text containing information that pertains to the subject. (TEXT INFORMATION) 2) Sample Rexx code to create a folder and program objects in the folder (FOLDER.CMD) 3) Sample Rexx code to create shadows of objects (SHADOW.CMD) 4) Sample Rexx code to create a folder, then program object in the folder, then place a shadow of the program object on the desktop. (FLDSHAD.CMD) ((BEGIN TEXT INFORMATION)) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Using the REXXUTIL SysCreateObject function Using V2's REXXUTIL SysCreateObject function one can create various objects; like folders, programs, and shadow objects using Rexx. This section for the most part includes parameter information which was gathered together from various sources of information. -- Help information regarding the SysCreateObject function of REXXUTIL -- Function: SysCreateObject Syntax: result=SysCreateObject(classname, title, location <,setup>, <,duplicateflag>) classname:The name of the object class. title: The object title. location: The object location. This can be specified as either a descriptive path (for example, OS/2 System Folder\System Configuration) or a file system path (for example, C:\bin\mytools). setup: A WinCreateObject setup string. duplicateflag: This parameter indicates what action should be taken when the Setup string specifies an object ID, and an object with that object ID already exists. If the setup string does not give an object ID, a duplicate object will be created. result The return code from WinCreateObject. This returns 1 (TRUE) if the object was created and 0 (FALSE) if the object was not created. Purpose: Create a new instance of an object class. --Interesting INI information:----------------------------------------------- If one views the *.RC files located in your bootdrive:\OS2 directory you can learn a lot about the various INI settings and folder structure. Review INI.RC and INISYS.RC files, they are used to create your OS2.INI and OS2SYS.INI files. --SysCreateObject / WinCreateObject------------------------------------------ The various fields of the SysCreateObject call map closely with the WinCreateObject call. /***************************************************************************/ /* This WinCreateObject function creates an instance of object class */ /* pszClassName, with title pszTitle, and places the icon and title in the */ /* location referred to by pszLocation. */ /***************************************************************************/ #define INCL_WINWORKPLACE #include PSZ pszClassName; PSZ pszTitle; PSZ pszSetupString; PSZ pszLocation; /* Folder location */ ULONG ulFlags; /* Creation flags */ HOBJECT Success; /* Success indicator */ Success = WinCreateObject(pszClassName, pszTitle, pszSetupString, pszLocation, ulFlags); -- Help information regarding the SysSetObjectData function of REXXUTIL -- Function: SysSetObjectData Syntax: result=SysSetObjectData(name, setup) name: The object name. This can be specified as an object id (for example ) or as a fully specified file name. setup: A WinCreateObject setup string. Purpose: Alter the settings of an existing object. See the description of the SysCreateObject location and setup strings below for an explanation of the parameters. -- Help information regarding the SysDestroyObject function of REXXUTIL -- Function: SysDestroyObject Syntax: result=SysDestroyObject(name) name: The object name. This can be specified as an object id (for example ) or as a fully specified file name. Purpose: Destroys an existing object. See the description of the SysCreateObject location parameter below for an explanation of the object name. --Putting it all together---------------------------------------------------- The SysCreateObject parameters are now explained in more detail. (As I understand them...) Remember Syntax: result = SysCreateObject(classname, title, location <,setup>) classname: A registered object class defined to the system. Of particular interest are the WPFolder/WPProgram/WPShadow classes. Note using the sample Rexx code included in the SysQueryClassList function help screen one can list all of the registered classes: call SysQueryClassList "list." do i = 1 to list.0 say 'Class' i 'is' list.i end title: Easy one, the objects title you want to use. If you wish to break the title line use the carat "^" symbol in the title. Ex. 'First line^Second Line' location: You can see above what the online Help information has in regards to this field. However by looking at the INI.RC file one can see a use of other "locations", such as . If this is used as a location then your object will reside on the WorkPlace Shell desktop. If you are creating a folder or program object you should make sure you use the setup string option and give that folder a unique OBJECTID. We'll see how this works later. HINTS: Here are some predefined object ids of system folders. Also if you are thinking of placing an object in the Startup Folder , make it a shadow of the object. The Desktop. The Startup folder. The System folder. The Templates folder. The System Setup folder. The Information folder. The Drives folder. The hidden folder. setup: This field needs the most explaining, and required the most "snooping". The setupstring field contains a series of "keyname=value" pairs separated by semi-colons that change the behavior of an object. Each object class documents its keynames and the parameters it expects to see. duplicateflag: There are three possible values for this parameter: FailIfExists - No object should be created if an object with the given object already exists. This is the default. ReplaceIfExists - If an object with the given object ID already exists, the existing object should be replaced. UpdateIfExists - If an object with the given object ID already exists, the existing object should be updated with the new information. (Only the first character is required/examined) ALL parameters have safe defaults, so it is never necessary to pass unnecessary parameters to an object. Setup Strings: -------------- Below are both WPFolder and WPProgram setup string parameters. Their various key names, values and a short description follow each item. The <> item is there to give you an idea of what settings "page" you would find this information on. ********************************* ***WPFolder setup string parms*** ********************************* KEYNAME VALUE Description ----------------------------------------------------------------------------- <> OPEN ICON Open icon view when object is created. TREE Open tree view when object is created. DETAILS Open details view when object is created. ICONVIEW s1[,s2,...sn] Set icon view to specified style(s). TREEVIEW s1[,s2,...sn] Set tree view to specified style(s). DETAILSVIEW s1[,s2,...sn] Set details view to specified style(s). (styles) FLOWED flowed list items NONFLOWED non-flowed list items NONGRID non-gridded icon view NORMAL normal size icons MINI small icons INVISIBLE no icons LINES lines in tree view NOLINES no lines in tree view <> BACKGROUND filename Sets the folder background. filename is the name of a file in the \OS2\BITMAP directory of the boot drive. <> WORKAREA YES Make the folder a Workarea folder <> MINWIN HIDE Views of this object will hide when their minimize button is selected. VIEWER Views of this object will minimize to the minimized window viewer when their minimize button is selected. DESKTOP Views of this object will minimize to the Desktop when their minimize button is selected. VIEWBUTTON HIDE Views of this object will have a hide button as opposed to a minimize button. MINIMIZE Views of this object will have a minimize button as opposed to a hide button. CONCURRENTVIEW YES New views of this object will be created every time the user selects open. NO Open views of this object will resurface when the user selects open. <> ICONFILE filename This sets the object's icon. ICONRESOURCE id,module This sets the object's icon. 'id' is the identity of an icon resource in the 'module' dynamic link library (DLL). ICONPOS x,y This sets the object's initial icon position. The x and y values represent the position in the object's folder in percentage coordinates. TEMPLATE YES Creates object as a template. NO Resets objects template property. ----------------------------------------------------------------------------- ********************************** ***WPProgram setup string parms*** ********************************** KEYNAME VALUE Description ----------------------------------------------------------------------------- <> EXENAME filename Sets the name of the program PARAMETERS params Sets the parameters list, which may include substitution characters STARTUPDIR pathname Sets the working directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <> PROGTYPE FULLSCREEN Sets the session type to OS/2 full screen PM Sets the session type to PM SEPARATEWIN Sets the session type to WIN-OS2 window running in a separate VDM. VDM Sets the session type to DOS full screen WIN Sets the session type to WIN-OS2 full screen WINDOWABLEVIO Sets the session type to OS/2 windowed WINDOWEDVDM Sets the session type to DOS windowed WINDOWEDWIN Sets the session type to WIN-OS2 windowed MINIMIZED YES Start program minimized MAXIMIZED YES Start program maximized NOAUTOCLOSE YES Leaves the window open upon program termination. NO Closes the window when the program terminates. -DOS Settings- NOTES: - To change these values you use SET keyname= Example: SET DOS_FILES=45;SET DOS_HIGH=1 Also for some use values of 1 for ON, 0 for off Example: SET COM_HOLD=1; (on, default is off) To add more than one DOS_DEVICE you need to separate with hex 0A (line-feed) Rexx example: h0A='0A'X setup='...;SET DOS_DEVICE=C:\OS2\MDOS\ANSI.SYS'h0A'C:\OS2\MDOS\EGA.SYS...' List of DOS Setting fields COM_HOLD DOS_BACKGROUND_EXECUTION DOS_BREAK DOS_DEVICE DOS_FCBS DOS_FCBS_KEEP DOS_FILES DOS_HIGH DOS_LASTDRIVE DOS_RMSIZE DOS_SHELL DOS_STARTUP_DRIVE DOS_UMB DOS_VERSION DPMI_DOS_API DPMI_MEMORY_LIMIT DPMI_NETWORK_BUFF_SIZE DPMI_DOS_API EMS_FRAME_LOCATION EMS_HIGH_OS_MAP_REGION EMS_LOW_OS_MAP_REGION EMS_MEMORY_LIMIT HW_NOSOUND HW_ROM_TO_RAM HW_TIMER IDLE_SECONDS IDLE_SENSITIVITY KBD_ALTHOME_BYPASS KBD_BUFFER_EXTEND KBD_RATE_LOCK MEM_INCLUDE_REGIONS MEM_EXCLUDE_REGIONS MOUSE_EXCLUSIVE_ACCESS PRINT_TIMEOUT VIDEO_FASTPASTE VIDEO_MODE_RESTRICTION VIDEO_ONDEMAND_MEMORY VIDEO_RETRACE_EMULATION VIDEO_ROM_EMULATION VIDEO_SWITCH_NOTIFICATION VIDEO_WINDOW_REFRESH VIDEO_8514A_XGA_IOTRAP XMS_HANDLES XMS_MEMORY_LIMIT XMS_MINIMUM_HMA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <> ASSOCFILTER filters Sets the filename filter for files associated to this program. Multiple filters are separated by commas. ASSOCTYPE type Sets the type of files associated to this program. Multiple filters are separated by commas. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <> MINWIN HIDE Views of this object will hide when their minimize button is selected. VIEWER Views of this object will minimize to the minimized window viewer when their minimize button is selected. DESKTOP Views of this object will minimize to the Desktop when their minimize button is selected. VIEWBUTTON HIDE Views of this object will have a hide button as opposed to a minimize button. MINIMIZE Views of this object will have a minimize button as opposed to a hide button. CONCURRENTVIEW YES New views of this object will be created every time the user selects open. NO Open views of this object will resurface when the user selects open. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <> ICONFILE filename This sets the object's icon. ICONRESOURCE id,module This sets the object's icon. 'id' is the identity of an icon resource in the 'module' dynamic link library (DLL). ICONPOS x,y This sets the object's initial icon position. The x and y values represent the position in the object's folder in percentage coordinates. TEMPLATE YES Creates object as a template. NO Resets objects template property. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <> OBJECTID This sets the object's identity. The object id will stay with the object even if it is moved or renamed. An object id is any unique string preceded with a '<' and terminated with a '>'. This may also be a real name specified as a fully qualified path name. HELPPANEL id This sets the object's default help panel. HELPLIBRARY filename This sets the help library. OPEN SETTINGS Open settings view when object is created. DEFAULT Open default view when object is created. NODELETE YES Will not allow you to delete the object. NOCOPY YES Will not allow you to make a copy. NOMOVE YES Will not allow you to move the object to another folder, will create shadow on a move. NODRAG YES Will not allow you to drag the object. NOLINK YES Will not allow you to create a shadow link. NOSHADOW YES Will not allow you to create a shadow link. NORENAME YES Will not allow you to rename the object. NOPRINT YES Will not allow you to print it. NOTVISIBLE YES Will not display the object. ----------------------------------------------------------------------------- Good Luck.... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ((END TEXT INFORMATION)) ((BEGIN REXX CMD SAMPLES)) - (FOLDER.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* FOLDER.CMD: Sample code using REXXUTIL's SysCreateObject function */ /* Builds a folder on the DeskTop and places some program objects in it.*/ /* Load REXXUTIL */ call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs call sysloadfuncs /* The basic call is listed next. */ /* result = SysCreateObject(classname, title, location, setup) */ call SysCls Say '';Say 'Using REXXUTILs to Add a Folder and Program Objects...' Say '';Say 'Press Y to add Test Folder to Desktop...';Say ''; parse upper value SysGetKey('NOECHO') with key If key<>'Y' Then Exit /* All of the routines pass parameters to a subroutine to perform the call */ classname='WPFolder' title='Test Folder' location='' setup='OBJECTID=' Call BldObj Say '';Say 'Now go and open up the folder, currently no items are there.' Say 'Press ENTER and we will add a few program objects...' key=SysGetKey() Say 'Place a program object into the folder...';Say ''; classname='WPProgram' title='SYSLEVEL-FULLSCR' location='' setup='PROGTYPE=FULLSCREEN;EXENAME=\OS2\SYSLEVEL.EXE;OBJECTID=' Call BldObj classname='WPProgram' title='CHKDSK-PM' location='' setup='MINIMIZED=YES;PROGTYPE=PM;EXENAME=\OS2\PMCHKDSK.EXE;OBJECTID=' Call BldObj classname='WPProgram' title='SYSLEVEL-VIO' location='' setup='PROGTYPE=WINDOWABLEVIO;EXENAME=\OS2\SYSLEVEL.EXE;OBJECTID=' Call BldObj classname='WPProgram' title='MEM-Fullscreen' location='' setup='PROGTYPE=VDM;EXENAME=\OS2\MDOS\MEM.EXE;PARAMETERS=/?;NOAUTOCLOSE=YES;OBJE Call BldObj classname='WPProgram' title='MEM-WindowVDM' location='' setup='PROGTYPE=WINDOWEDVDM;EXENAME=\OS2\MDOS\MEM.EXE;PARAMETERS=/?;NOAUTOCLOSE= Call BldObj Say '';Say 'All done, to remove objects drag to shredder...' Exit /* Build Object */ BldObj: call charout ,'Building: 'title result = SysCreateObject(classname, title, location, setup) If result=1 Then call charout ,'... Object created!' Else call charout ,'... Not created! Return code='result Say ''; Return - (SHADOW.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* SHADOW.CMD: Sample code using REXXUTIL's SysCreateObject function */ /* Builds shadows on the DeskTop and Startup Folder */ call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs call sysloadfuncs Call SysCls Say '';Say 'Using REXXUTILs to Add Shadow Objects...' /* The titles and objectid's are found from the \OS2\INI.RC file */ Say '';Say 'First lets place some items on the Desktop...' title='Enhanced Editor'; objid='' ; loc=''; call AddShad title='OS/2 Window' ; objid=''; loc=''; call AddShad title='System Clock' ; objid='' ; loc=''; call AddShad Say '';Say 'You can even make shadow objects of files...' title='CONFIG.SYS'; objid='C:\CONFIG.SYS' ; loc=''; call AddShad Say '';Say 'Now lets place an item in the Startup Folder...' title='System Clock' ; objid='' ; loc='' ; call AddShad Say '';Say 'All done, to remove objects drag to shredder...' Exit AddShad: Say '';Say 'Press Y to add shadow object: 'title' to 'loc parse upper value SysGetKey('NOECHO') with key If key='Y' Then Do result=SysCreateObject('WPShadow', title, loc, 'SHADOWID='objid) If result=1 Then Say 'Object created' Else Say 'Not created, return code='result End Return - (FLDSHAD.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* FLDSHAD.CMD: Sample code using REXXUTIL's SysCreateObject function */ /* Builds a folder on the DeskTop places a program object in it then */ /* places a shadow of the program object on the DeskTop. */ /* Load REXXUTIL */ call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs call sysloadfuncs /* The basic call is listed next. */ /* result = SysCreateObject(classname, title, location, setup) */ call SysCls Say '';Say 'Using REXXUTILs to Add Folder/Program/Shadow Objects...' Say '';Say 'Press Y to add Test Folder to Desktop...';Say ''; parse upper value SysGetKey('NOECHO') with key If key<>'Y' Then Exit classname='WPFolder' title='Test Folder' location='' setup='OBJECTID=' Call BldObj Say '';Say 'Press Y to place a program object into the folder...';Say ''; parse upper value SysGetKey('NOECHO') with key If key<>'Y' Then Exit classname='WPProgram' title='SYSLEVEL-VIO' location='' setup='PROGTYPE=WINDOWABLEVIO;EXENAME=\OS2\SYSLEVEL.EXE;OBJECTID= Call BldObj Say '';Say 'Press Y to place a shadow of the program object on the Desktop...';S parse upper value SysGetKey('NOECHO') with key If key<>'Y' Then Exit classname='WPShadow' title='SYSLEVEL-VIO' location='' setup='SHADOWID=' Call BldObj Say '';Say 'All done, to remove objects drag to shredder...' Exit /* Build Object */ BldObj: call charout ,'Building: 'title result = SysCreateObject(classname, title, location, setup) If result=1 Then call charout ,'... Object created!' Else call charout ,'... Not created! Return code='result Say ''; Return - (STARTDOS.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* STARTDOS.CMD: Sample code using REXXUTIL's SysCreateObject function */ /* Starts a DOS program using specific DOS VDM settings. This */ /* particularly useful for LAN execution that requires NET USE commands.*/ /* This example invokes the PKZIP.EXE utility using a files setting of */ /* 45 */ /* Load REXXUTIL */ call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs call sysloadfuncs /* The basic call is listed next. */ /* result = SysCreateObject(classname, title, location, setup) */ classname='WPProgram' title='My DOS Program' location='' /* place in invisible folder */ program='EXENAME=C:\PKZIP.EXE;' /* DOS program name */ type='PROGTYPE=WINDOWEDVDM;' /* type of DOS session (windowed) */ startup='STARTUPDIR=C:\;' /* startup directory */ settings='SET DOS_FILES=45;' /* required DOS settings */ open='OPEN=DEFAULT;' /* open now */ call SysCreateObject classname, title, location,, program||type||startup||settings||open, 'REPLACE' - (BOOTDOS.CMD) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* BOOTDOS.CMD: Sample code using REXXUTIL's SysCreateObject function */ /* Starts a DOS session, booting from a specific DOS image with */ /* specific DOS VDM settings. */ /* Load REXXUTIL */ call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs call sysloadfuncs /* The basic call is listed next. */ /* result = SysCreateObject(classname, title, location, setup) */ classname='WPProgram' title='Booted DR DOS' location='' /* place in invisible folder */ program='EXENAME=*;' /* DOS program name (use shell) */ type='PROGTYPE=WINDOWEDVDM;' /* type of DOS session (windowed) */ image='C:\DRDOS.VM;' /* DOS image file */ /* required DOS settings */ settings='SET DOS_BACKGROUND_EXECUTION=ON;' open='OPEN=DEFAULT;' /* open now */ call SysCreateObject classname, title, location,, program||type||image||settings||open, 'REPLACE' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ((END REXX CMD SAMPLES))