REXX Tips & Tricks:Non-REXX related information

This section contains some additional information that is not REXX related but nevertheless useful - at least for me 'cause I'm using REXX mostly for CID installations and upgrades :-).

Environment variables & system variables
This section contains information about environment variables and CONFIG.SYS statements used by OS/2 and other programs.

The information in this section is collected from various sources.

For further information about the CONFIG.SYS I strongly recommend the tool ConfigTool.


 * Note: The CONFIG.SYS used if using ALT-F1 while the white square box is visible and than "C" to boot to a command shell is the file \OS2\BOOT\config.x.

Simulating an AUTOEXEC.BAT for OS/2 sessions
To simulate an AUTOEXEC.BAT for OS/2 sessions you can change the \CONFIG.SYS statement for OS2_SHELL to something like SET OS2_SHELL=C:\OS2\CMD.EXE /K C:\AUTOEXEC.CMD In this example the program AUTOEXEC.CMD is executed for every new OS/2 session. (see also Special filenames)

You may use this feature to set LIBPATHSTRICT in every OS/2 session

Source: The OS/2 WARP Survival Guide

Hints for programs and driver loaded in CONFIG.SYS
This section contains hints for programs and driver loaded in the CONFIG.SYS.

Loading HPFS.IFS (WARP 4)
Use the undocumented switch /FORCE for this filesystem to force immediate access to a "dirty" HPFS partition. HPFS partitions get "dirty" if you don't shutdown OS/2 (e.g. after crashing the system).

Use the undocumented switch /QUIET for this filesystem to suppress all messages from CHKDSK. Note that /QUIET cannot be the last parameter.

Example: IFS=C:\OS2\BOOT\HPFS.IFS /FORCE /AUTOCHECK:C Warning: Use these parameters with extreme care! Use it only when you really need it!


 * WARP 4 only!, Source: Team OS/2 WEB pages)

Loading IBMKBD.SYS (WARP 4)
The driver IBMKBD.SYS in WARP 4 accepts the parameters /NUMON and /NUMOFF to turn NUMLOCK on or off. These parameters used to work in the MERLIN Beta, but they are disabled in the WARP 4 GA.

CONFIG.SYS statements used by OS/2
This section contains some information about undocumented or poorly documented CONFIG.SYS statements used by OS/2.


 * AUTOFAIL=x:x maybe yes (no popup message for hard errors) or no (popup message for hard errors), default is no. Note that the DLL RXU contains a function to dynamically switch popup windows on and off.
 * Available: All versions
 * Source: various


 * AUTOREFRESHFOLDERS=NO:Suppress the automatic refresh of folder contents. If this feature is activated, you must manually refresh the view of a folder after each action
 * Available: WARP 4 only!
 * Source: various


 * DLLBASING=OFF:Reduce the fragmentation of loaded DLLs (ON by default)
 * Available: WSeB or after applying FP13 to Warp4
 * Source: various


 * DUMPPROCESS=x:Activate the dump process. The dump goes to the file PDUMP.nnn in the root directory of drive specified in x (where nnn is an unique number).
 * Available: All versions
 * Source: various


 * EARLYMEMINIT=TRUE:Adding "EARLYMEMINIT=TRUE" to config.sys will allow device drivers, etc., access to the memory above 16mb early in boot. Previously, this was only available after DD and IFS init was completed. This has various implications when enabled:
 * large VDISKs are possible. I tried DEVICE=\os2\vdisk.sys 16000
 * AHA154X.ADD may do bad things to your system. Don't even ask.
 * There may be some settings of HPFS386 cache that are incompatible. This feature is experimental.
 * Available: only available in the WARP kernels from testcase
 * Source: various


 * I13PAGES=1:SMP kernels could not be RIPL-booted. As part of this, there is a new config.sys parameter I13PAGES= available. Adding I13PAGES=1 to config.sys (note, no SET) reduces the memory usage of the mini VDM processes used by ibm1s506.add and the GRADD drivers. This becomes important in RIPL-boot situations.
 * Available: only available with Kernel 14.062 or higher
 * Source: various


 * MENUSTYLE=SHORT:Disable some entries from the object context menus
 * Available: All versions
 * Source: various


 * OBJECTSNOOZETIME=n:n is the snooze time for objects and DLLs in seconds (default is 90) (see Note)
 * Available: All versions
 * Source: various


 * PAUSEONERROR=x:Pause after each error in the CONFIG.SYS (x=YES) or not (x=NO). Default is YES.
 * Available: All versions
 * Source: various


 * REIPL=x:Save trap information into a file and reboot the workstation (x=ON) or display an error message (x=OFF). Default is OFF.
 * Available: All versions
 * Source: various


 * RESERVEDRIVELETTER=x:"The ability to reserve drive letters feature has been added at WARP FixPak level XRUW024. A modification has been made to the OS/2 kernel that will allow the user to specify, through a CONFIG.SYS parameter, specific drive letters that will not be allocated for local block mode devices during the processing of CONFIG.SYS. SYNTAX: RESERVEDRIVELETTER=x where x is letter D thru Z. Multiple RESERVEDRIVELETTER statements is be allowed."
 * Available: WARP 3 FixPack #24 and newer (e.g. Warp4, WSeB,etc)
 * Source: various


 * SHAPIEXCEPTIONHANDLER=OFF:Disable the WPS API exception handler (see Note)
 * Available: All versions
 * Source: various


 * SHELLEXCEPTIONHANDLER=OFF:Disable the WPS exception handler (see Note)
 * Available: All versions
 * Source: various


 * SET DEVICEFONTDISABLED=NO:Setting this to YES. will cause very large/slow print jobs, since no uploaded/internal printer fonts will be used. You want it set to NO in most cases (NO is the default).
 * Available: WSeB and probably more recent WARP 3/4 fixpaks
 * Source: Peter Fitzsimmons (see EMail Addresses)


 * SET ENH_STRETCH=NO:The new feature "enhanced stretch-blitting" has one known ill side-effect, where some of the icons for folders and other items will appear "washed out" when running in 24bpp or 32bpp. To fix this, you can disable the new feature by adding this line.
 * Available: Warp 4 FP14 and newer (e.g. Warp4, WSeB,etc)
 * Source: ConfigTool


 * SET KILLFEATUREENABLED=on:Activate the list of all processes in the WarpCenter (hold down CTRL and click on the windows icon on the WarpCenter to open the list).
 * Note that you can also use SCKILLFEATUREENABLED.
 * Available: WARP 4 only!
 * Source: c't 1/1997


 * SET LIBPATHSTRICT=x:(x maybe T (true) or F (false) Allows creation of a local version of the BEGINLIBPATH statement that can include DLLs that have the same name as globally loaded DLLs. The local DLLs are checked before the globals. Thus if your program has a DLL that is the same name as another, you can create a command file with the SET LIBPATHSTRICT=T, a SET BEGINLIBPATH=my program's dll, and the path & name of my program, and run your program.
 * Note that you must set this environment variable in an OS/2 session - an entry like "SET LIBPATHSTRICT=T" in the CONFIG.SYS is useless. (see also Simulating an AUTOEXEC.BAT for OS/2 sessions)
 * Available: New kernel instruction in WARP kernels from testcase since September 1, 2000
 * Source: ConfigTool


 * SET MENUSFOLLOWPOINTER=ON:This makes the WarpCenter menus behave like the Start menu of Windows 95: The menus follow the mouse pointer.
 * Available: WARP 4 with Fixpack #5 or later
 * Source: various


 * SET NOLARGENTEXEICON=n:Limit the number of megabytes (=n) the WPS should scan through Windows EXE files for the program icon before assigning a default icon
 * Available: New kernels from testcase (APAR PJ27886)
 * Source: XWorkplace Mailinglist


 * SET NEWNOTEBOOKS=ON:Enables the new notebooks for applications written prior to WARP 4
 * Available: This setting worked in the MERLIN Beta, but seems to be disabled in WARP 4 GA.
 * Source: various


 * SET PM_ASYNC_FOCUS_CHANGE=x {time}:Enable the SIQFix (Single Input Queue Fix) and set the custom time-out to time ms (default: 2000). Set x to OFF or remove the statement to disable the SIQFix
 * Available: WARP 3 FixPack #17 and newer (e.g. Warp4, WSeB,etc)
 * Source: various


 * SET PM_DYNAMIC_DRAG=x:Activate (x=ON) or deactivate (x=OFF, default) the full window drag for PM windows
 * Available: WARP 3 FixPack #17 and newer (e.g. Warp4, WSeB,etc)
 * Source: various


 * SET PM_ROLLUP_BUTTON=YES:Adds a new button to the window titlebars that you can use to "Roll up your PM windows to just a titlebar".
 * Available: This setting worked in the MERLIN Beta, but seems to be disabled in WARP 4 GA.
 * Source: Team OS/2 WEB pages


 * SET PM_PRINTSCREEN_ACTIVE_WINDOW=x:(x can be ON or OFF) If x is ON the window with the focus will print when a Print Screen operation is initiated. If x is OFF, the default Print Screen operation takes place.
 * Available: Warp 4 FP13
 * Source: ConfigTool


 * SET QUEUE_SIZE_THRESHOLD=X:Change the size of the message queue. Default is 100 for version prior to the WARP 3 Fixpack #17 and 3000 for the WARP 3 Fixpack #17.
 * Available: WARP 3 FixPack #17 and newer (e.g. Warp4, WSeB,etc)
 * Source: various


 * SET RESTARTOBJECTS=x:Control the restart behaviour of the WPS, x may be YES (default), NO, STARTUPFOLDERSONLY or REBOOTONLY.
 * Available: All versions
 * Source: various


 * SET RUNWORKPLACE=C:\OS2\PMSHELL.EXE:This statements points to the shell program to use - normally that's the program C:\OS2\PMSHELL.EXE. But you can change this to any other program if you want to restrict the PC to only run that program (e.g. SET RUNWORKPLACE=C:\OS2\MDOS\WINOS\PROGMAN.EXE).
 * Available: All versions
 * Source: various


 * SET SCCANBENUKED=ON:This makes the WARPCenter object "nukeable" i.e. you can right click and choose "Delete" which is not possible normally.
 * If SCCANBENUKED does not work, try CANBENUKED.
 * Available: WARP 4 only!
 * Source: Team OS/2 WEB pages


 * SET SCFINDUTILITY={anyprogram_or_anyObjectID}:This allows you to define any external program (OS/2, DOS, Windows, or even an object ID like !) for the flashlight icon on the WARPCenter. Click the little flashlight icon (WARPCenter) and you get whatever you specified.
 * If SCFINDUTILITY does not work, try FINDUTILITY.
 * Available: WARP 4 only!
 * Source: Team OS/2 WEB pages


 * SET SCKILLCONFIRMDISABLED=ON:Avoid the "Are you sure dialog" if using the kill feature of the WARPCenter activated with SET KILLFEATUREENABLED=on. Note that you must also add the entry SET KILLCONFIRMDISABLED=1 to make this work.
 * Available: WARP 4 only!
 * Source: Team OS/2 WEB pages

If SCUSEPRETTYCLOCK does not work, try USEPRETTYCLOCK.
 * SET SCUSEPRETTYCLOCK=1:Change the color of the clock from the WARPCenter to green on black
 * Available: WARP 4 only!
 * Source: Team OS/2 WEB pages


 * SET SHELLHANDLESINC=n:Increment the number of file handles available to a shell process (e.g. a REXX program started by the CMD.EXE) by the amount of n. (see also Maximum files per session; tested only in WARP 4 with Fixpack #6)
 * Available: WARP 4 with Fixpack #6
 * Source: various


 * SUPPRESSPOPUPS=x:Save error information into the file POPUPLOG.OS2 in the root directory of the drive x and suppress the dialogs (On WARP 4 with Fixpack #3 x may be 0 to simulate the behaviour of OS/2 versions prior to this version).
 * Available: All versions
 * Source: various


 * SXFAKEHWFPU=1:Activate a fix for a "math rounding error" in WARP 4
 * Available: WARP 4 only! Fixpack #1
 * Source: WARP 4 Fixpack 1 documentation


 * VIRTUALADRESSLIMIT=n:(n is the limit in kb)
 * The default value for VIRTUALADDRESSLIMIT in OS/2 Warp Server for e-business is 1 GB (n=1024). The VIRTUALADDRESSLIMIT parameter is also available for OS/2 Warp Server SMP Feature and Warp 4.0 Fixpak 13. Areas of memory below 512 MB have been remapped for higher availability in that region.
 * 2048 allows max. memory allocated 2 Gigs of shared RAM. Only useful for developers.
 * You must have a hard disk that can accommodate the swap file. UW2SCSIs are recommended for the swap disk unless you wish to see your computer behave like a washing machine in spin dry mode.
 * The OS/2 Warp Server Advanced SMP addendum states that this number can go to 3 Gigs. Memory support has also been enhanced since now an application can access a virtual memory address space of up to 3 GB by use of the VIRTUALADDRESSLIMIT = 3072 parameter in CONFIG.SYS. Areas of memory below 512 MB have been remapped for higher availability in that region.
 * Available: WSeB, Warp Server SMP, and Warp 4.0 Fixpak 13
 * Source: ConfigTool


 * VME=NO:Turn "Virtual mode extension (VME)" off (see Note about VME)
 * Available: All versions
 * Source: various

Note about VME
"Virtual Mode Extensions is a hardware enhancement Intel added to their CPUs beginning with the DX2 models. All Pentium processors also come with this feature. VME is intended to speed up a number of privileged functions (CPU instructions) for applications running in virtual mode sessions (for example, DOS and WinOS2 sessions).

DOS (and Windows) apps running in an OS/2 Virtual DOS Machine (VDM) believe they "own" the hardware. On occasion these apps will try to do something to the (virtual) hardware that isn't permitted while a protected mode operating system such as OS/2 is in control of the real hardware because permitting such "privileged" operations would negatively impact overall system integrity and reliability.

On a non-VME processor attempting such privileged operations would result in a (hardware generated) program interrupt, and hence an operating system (in this case, OS/2) interrupt handler to get control. Control would eventually pass to a routine that would simulate the attempted function. On a VME processor the function simulation would be carried out by microcode on the processor itself. This is both transparent (to the operating system and app) and faster, BUT only if it works.

Unfortunately there are apparently some conditions that can arise where this (usually) transparent handling of privileged operations (in effect, a hardware implemented microcode "assist") can leave the system in an inconsistent operating state. In this case the operating system will force a TRAP condition to protect itself (and YOUR data).

Adding the "VME=NO" line to "CONFIG.SYS" forces all VME "assisted" CPU instructions to be reflected to, and handled by, the operating system; in other words, the way it would have worked had the VME feature not have been present.

"VME=NO" is not a panacea fix for all your DOS/Windows woes. Indeed the most common symptom of VME related problems is frequent "Trap D" and "Trap E" errors in DOS and WinOS2 sessions. Therefore, I doubt it will correct all the problems you've listed, but it MAY provide some relief. Can't hurt to try.

Ron Higgin OS/2 Advisor! (see EMail Addresses)"

Environment variables used by OS/2
This section contains some information about undocumented or poorly documented environment variables used by OS/2.

Please note, that you must use SET name=value to use the environment variables!


 * CONNECT_DASD=NO:Turns off DASD checking while installing OS/2. This enables the user to install a product if the installation program thinks there is not enough diskspace (used by the OS/2 WARP Connect installation program)
 * Available: All versions
 * Source: various


 * CONNECT_PREREQ=NO:Turns off prerequisite checking. This enables the user to install a product when the installation program thinks that it cannot be installed (used by the OS/2 WARP Connect installation program).
 * Available: All versions
 * Source: various


 * CONNECT_SNIFF=NO:Turns off network card detection. This may be necessary if the detection logic hangs the machine while detecting adapters (used by the OS/2 WARP Connect installation program).
 * Available: All versions
 * Source: various


 * COPYFROMFLOPPY=1
 * Set to 1, if the OS/2 installation program should copy drivers from disk A: instead of copying this files from the CD-ROM
 * Available: All versions
 * Source: various


 * DELDIR=path_for_the_deleted_files
 * This is a real environment variable, see DELDIR
 * Available: All versions
 * Source: various


 * DESKTOP=wps_directory|wps_object_ID
 * Points to the WPS directory if the object ID  is missing in the ini file
 * Available: All versions
 * Source: various


 * DIRCMD=default_dir_switches
 * Used to set the default options for the DIR command DOSSETTING.{dossetting}={value}
 * Use the value {value} for the setup string {dossetting} in the next DOS session opended with the START command. (see Start a program with specific settings for an example; WARP 4 only!).
 * Available: All versions
 * Source: various


 * SOURCEPATH=os2_image_directory
 * Points to the disk images used by the OS/2 installation program SYSINST2.EXE
 * Available: All versions
 * Source: various


 * SYSTEM_INI=C:\OS2\OS2SYS.INI
 * This statement contains the path & name of the system ini file.
 * Available: All versions
 * Source: various


 * TRUEMODE=1
 * Set this environment variable to install the TrapDoor feature of WARP 4, even on a machine with SCSI HDs only.
 * Available: WARP 4 only!
 * Source: various


 * USER_INI=C:\OS2\OS2.INI
 * This statement contains the path & name of the user ini file.
 * Available: All versions
 * Source: various


 * VIDEO_DEVICES=env_var
 * This statement sets the name of the OS/2 environment variable that contains the base video driver name.
 * Available: All versions
 * Source: The OS/2 WARP Survival Guide


 * VIO_SVGA=DEVICE(BVHVGA,BVHSVGA)
 * This statement selects the base video support.
 * Available: All versions
 * Source: The OS/2 WARP Survival Guide


 * WIN3DIR=win311_directory
 * This environment variable must point to the directory with your Windows 3.1 if using the TrapDoor feature of WARP 4.
 * Available: WARP 4 only!
 * Source: various


 * WP_OBJHANDLE=n
 * This environment variable contains the object handle for the current OS/2 session. This handle is unique for each OS/2 session started via an WPS Object. Note that OS/2 sessions started via the START command inherit the value from the parent.
 * Available: All versions
 * Source: various

DELDIR
You can change the environment variable DELDIR in OS/2 sessions to change the UNDELETE behaviour for a special session.

Examples: REM *** OS/2 Batch file to change the DELDIR directory for one session SET DELDIR=C:\DELDIR1,512;D:\DELDIR_C,512;

REM *** OS/2 Batch to disable DELDIR, delete some files and enable REM    DELDIR again

SETLOCAL SET DELDIR= DEL D:\TEMP\*.* ENDLOCAL

REM *** OS/2 Batch to change the DELDIR directory, delete some files REM    and restore the DELDIR directory afterwards SETLOCAL SET DELDIR=D:\MY_DELDIR,512 DEL D:\TEMP\*.* ENDLOCAL Note: This method is also possible in DOS sessions.

Environment variables used by other OS/2 programs
This section contains some information about undocumented or poorly documented environment variables used by other OS/2 programs.


 * CSFCDROMDIR=path
 * Points to the directory with the fixpack (used by SERVICE.EXE) CSFUTILPATH=path
 * Points to the directory with the files from the kicker diskettes (used by SERVICE.EXE)


 * EPFINSTDIR=path:Points to the configuration files for the Software Installer/2 (default is \OS2)
 * IBMWORKS_INI=path:Points to the path for data files for the PIM from IBM Works
 * IROPT=options:Undocumented environment variable for Dualstor (IBM) possible values: d: no FIFO, D: use FIFO, x: 0.5 MBit/s, X: 1 MBit/s
 * NCDEBUG=n:Environment variable needed by Lotus 123 for video and audio playback
 * REMOTE_INSTALL_STATE=x:Environment variable used for CID installations. Warning: If this variable is defined, all installation programs created with Software Installer/2 will not display!

BEGINLIBPATH/ENDLIBPATH
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 not 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

Detecting some common SCSI adapters
You can use the EXE files in the directory \OS2\DRIVERS to detect if one of the common SCSI adapters is installed (common means: supported by OS/2). These files are detection modules used by OS/2 to detect the installed SCSI adapter.

A list of the used detection modules can be found in the file \OS2\INSTALL\SCSI.TBL. This list is used by the installation program.

Each of the detection modules returns 0 if the SCSI adapter is installed else a value not equal zero (1 or 255).

For additional information about this file see The Guide to OS/2 WARP Device Drivers (sg244627.boo).

OS/2 Traps
Trap Function      OS/2 MSG (SYSxxxx) Likely cause under OS/2: ======================================================================== 0000 Divide error                3184 division by zero by OS/2 0001 Debug exception                  shouldn't occur 0002 NMI Interrupt                    memory parity or 387 error 0003 One Byte Interrupt               shouldn't occur 0004 Interrupt on Overflow       3185 from INTO instruction 0005 Array Bounds Check          3191 from BOUND instruction 0006 Invalid OP-Code             3176 usually a corrupted .EXE 0007 Device not Available             from ESC or WAIT instruction 0008 Double Fault                     shouldn't happen 0009 Reserved by Intel 000A Invalid TSS (Task State Segment) OS/2 bug - not a common bug 000B Segment not Present              Can be a program or OS/2 bug 000C Stack Fault                      stack was ruined (not common) 000D General Protection Fault         invalid pointer (most common) 000E Page Fault                       OS/2 bug, error in virtual mem 000F Reserved by Intel To get more information about a specific trap use the HELP command with the parameter 1930+trap number.

Examples: REM *** Help for Trap 2 (1930+2 = 1932) HELP 1932 REM *** Help for Trap 0E (1930+14 = 1944) HELP 1944 To find the program that caused a trap you can use the program exeinfo.exe (available on hobbes for example (see Internet - Web Pages)).

Search the line beginning with CS:EIP in the trap output and write down the number after CSLIM. After reboting the PC you can use the command exeinfo -f -l#### (where #### are the last 4 digits of the number after CSLIM=) to get the program that caused the error.

Example: If the trap output contains the line CS:EIP=0658:00001a5c CSACC=009b CSLIM=00004e3a the exeinfo command is exeinfo -f -l4e3a

Usage of RESERVE.SYS
Usage: basedev=reserve.sys arguments

Possible arguments are:
 * Notes:More than one resource attribute per resource entry is an error and not allowed. If no attributes or decode width is set, the default is EXCLUSIVE and 16.
 * Examples:To reserve IRQ 13 EXCLUSIVE, DMA 0 SHARED, MEMORY CA00:0 for 1000 bytes shared, IO ports 340 for 10 ports EXCLUSIVE and decode width 16, and IO ports 300 for 64 ports Grant Yield, with a decode width of 10 use: BASEDEV=RESERVE.SYS /IRQ:13 /DMA:0 /SHA /MEM:CA00,3E8 /SHA /IO:340,A /IO:300,100 /GY /DW:10
 * Note: The syntax for the driver is documented in the Online documentation of WARP 4.

OS/2 Batch Programming
This section contains some hints for OS/2 batch programs.

Using sub routines in batch programs
 @ECHO OFF REM -- REM REM *** sample code to show how to use subroutines in OS/2 batch files REM REM --

REM *** set a sample environment variable REM SET myEnvVar=1

REM --

ECHO. [MAIN] The value of the environment variable "MyEnvVar" is %MyEnvVar%

ECHO. [MAIN] Now MAIN calls "subroutine" SUB1 ...

REM *** save the return address in an environment variable and call REM    the "subroutine" REM SET retAddr1=RET001 GOTO SUB1

REM *** SUB1 jumps to this label to return to the caller
 * RET001

REM --

ECHO. [MAIN] The value of the environment variable "MyEnvVar" is %MyEnvVar%

ECHO. [MAIN] Now MAIN calls "subroutine" SUB2 ...

REM *** save the return address in an environment variable and call REM    the "subroutine" REM SET retAddr2=RET002 GOTO SUB2

REM *** SUB2 jumps to this label to return to the caller
 * RET002

ECHO. [MAIN] The value of the environment variable "MyEnvVar" is %MyEnvVar%

REM -- REM *** do something ... PAUSE

REM *** set a sample environment variable REM SET myEnvVar=2

REM -- ECHO. [MAIN] Now MAIN calls "subroutine" SUB1 ...

ECHO. [MAIN] The value of the environment variable "MyEnvVar" is %MyEnvVar%

REM *** save the return address in an environment variable and call REM    the "subroutine" REM SET retAddr1=RET003 GOTO SUB1

REM *** SUB1 jumps to this label to return to the caller
 * RET003

REM --

ECHO. [MAIN] The value of the environment variable "MyEnvVar" is %MyEnvVar%

ECHO. [MAIN] Now MAIN calls "subroutine" SUB2 ...

REM *** save the return address in an environment variable and call REM    the "subroutine" REM SET retAddr2=RET004 GOTO SUB2

REM *** SUB2 jumps to this label to return to the caller
 * RET004

ECHO. [MAIN] The value of the environment variable "MyEnvVar" is %MyEnvVar%

REM -- REM *** house keeping REM SET retAddr1= SET retAddr2= SET myEnvVar=

REM *** and end the program GOTO End

REM -- REM *** This is the "subroutine" SUB1 REM    SUB1 has a local variable scope REM
 * SUB1

SETLOCAL ECHO. [SUB1] *** This is SUB1 (local variable scope) ECHO. [SUB1] The value of the environment variable "MyEnvVar" is %MyEnvVar% ECHO. [SUB1] Setting the variable "myEnvVar" to 11 SET myEnvVar=11

ECHO. [SUB1] The value of the environment variable "MyEnvVar" is %MyEnvVar%

ECHO. [SUB1] Now SUB1 calls "subroutine" SUB2 ... SET retAddr2=SUB2_1 GOTO SUB2

REM *** SUB2 jumps to this label to return to the caller
 * SUB2_1

ECHO. [SUB1] The value of the environment variable "MyEnvVar" is %MyEnvVar%

ECHO. ECHO. [SUB1] Now I am returning control back to the label %retAddr1%

ENDLOCAL GOTO %retAddr1%

REM -- REM *** This is the "subroutine" SUB2 REM    SUB2 has a global variable scope REM
 * SUB2

ECHO. [SUB2] *** This is SUB2 (global variable scope) ECHO. [SUB2] The value of the environment variable "MyEnvVar" is %MyEnvVar%

ECHO. [SUB2] Setting the variable "myEnvVar" to 22 SET myEnvVar=22

ECHO. [SUB2] Now I am returning control back to the label %retAddr2% GOTO %retAddr2%

REM -- REM *** label marking the program end REM
 * END



Simulating SELECT in batch programs
 @ECHO OFF REM REM *** sample code to show how to simulate SELECT in OS/2 Batch files REM REM This batch file simulates the following REXX code: REM REM  parse arg val REM  if val = '' then REM    val = varA REM REM  SELECT REM REM    WHEN val=varA THEN REM      say 'This is 'val REM REM    WHEN val=varB THEN REM      say 'This is 'val REM REM    WHEN val=varC THEN REM      say 'This is 'val REM REM    WHEN val=varD THEN REM      say 'This is 'val REM REM    OTHERWISE REM    DO REM       say 'Invalid parameter 'val REM      EXIT 255 REM    END /* OTHERWISE */ REM REM  END /* select */ REM REM  EXIT 0 REM REM    Note that this method is useful for processing parameter REM    because it's not case sensitive. REM    (see Using the SELECT simulation for parameter checking ) REM REM History: REM REM 01.02.1997 /bs REM  - added code to simulate OTHERWISE also REM    (based on code from Ralf Ulrich (see EMail Addresses)) REM REM

REM -- REM *** Use "varA" if the parameter is omitted REM SET var=%1 IF '%var%' == '' SET var=varA

REM -- REM *** Now goto to the appropriate label REM    (or print an error message and exit if the label does not exist) REM REM

GOTO x%var% 2>NUL || (ECHO.&ECHO.Invalid parameter "%var%"!&EXIT 255) REM REM                 ^ REM                 This is the code for OTHERWISE REM                 Note that you CANNOT use a GOTO command here! If the REM                 first GOTO fails, the program is always aborted! REM

REM *** The following are the labels for the known values REM REM    In this example you can use the parameter varA, varB, varC, REM    and varD. REM

REM --
 * xVarA

ECHO. This is "%var%" GOTO HouseKeeping

REM --
 * xVarB

ECHO. This is "%var%" GOTO HouseKeeping

REM --
 * xVarC

ECHO. This is "%var%" GOTO HouseKeeping

REM --
 * xVarD

ECHO. This is "%var%" GOTO HouseKeeping

REM -- REM *** house keeping
 * HouseKeeping

SET var=

REM *** and end the program GOTO End

REM -- REM *** label marking the program end
 * END

EXIT 0 

Using the SELECT simulation for parameter checking
 @ECHO OFF REM -- REM REM *** sample batch cmd to show a method for checking the parameter REM REM    Note: The maximum length for a label is 8 characters! REM          Therefore, GOTO L123456789A matches the label L12345678 REM          and GOTO L12345678 matches the label L123456789A! REM REM          This means, that parameter processed with this method REM          can only have up to 7 characters (see note in line 25)! REM REM see also Sample code for parameter parsing REM REM -- REM *** Special Parameter to distinguish between Pass1 and Pass2 REM SET sParm=$$PASS2$$

REM -- REM *** Save the name of this program REM    (necessary because we use the SHIFT command below!) REM SET sProg=%0

REM -- REM *** check if this is a Pass1 or a Pass2 call REM    (Note: The leading 'x' (or any other character) is necessary REM            because a label must begin with a character!) REM IF '%1' == '%sParm%' GOTO x%2

REM -- REM *** This is pass1 REM
 * $$Loop$$

REM *** The environment variable ParamOK is set to 1 in pass2 REM    if the parameter was ok REM SET paramOK=

REM *** check for further parameter REM IF '%1' == '' GOTO $$End$$

REM *** call this program again to check the parameter REM    (suppress STDERR to avoid error messages for the not REM      found labels in case of an unknown parameter) REM call %sProg% %sParm% %1 2>NUL

REM *** process the next parameter REM SHIFT

REM *** check if the parameter is known REM IF '%paramOK%' == '1' GOTO $$LOOP$$

REM *** Last parameter was unkown REM ECHO. Error: Do not know the parameter "%0"!

GOTO $$LOOP$$

REM -- REM *** code to process the parameter

REM -- REM *** This code handles the parameter Help, /help -help, ?, /? and -? REM    in any case (mixed, upper and lower) REM
 * xHelp
 * x?
 * x/?
 * x/help
 * x-help
 * x-?

ECHO. ECHO. Usage: %sProg% {anyParameter} ECHO. ECHO. Known parameter are: ECHO. ECHO. Help /help -help ? /? -? ECHO. /Param1 /Param2 ECHO. ECHO. in any case (mixed, lower or upper). ECHO. ECHO. The parameter found is "%2". ECHO.

REM *** Signal 'Parameter is okay' to the calling program REM SET paramOK=1

REM *** and end pass2 REM GOTO $$End1$$

REM -- REM *** This code handles the parameter /PARAM1 REM    in any case (mixed, upper and lower) REM
 * x/PARAM1

ECHO. ECHO. Parameter /PARAM1 found! ECHO. (Parameter is "%2")

REM *** Signal 'Parameter is okay' to the calling program REM SET paramOK=1

REM *** and end pass2 REM GOTO $$End1$$

REM -- REM *** This code handles the parameter /PARAM2 REM    in any case (mixed, upper and lower) REM
 * x/PARAM2

ECHO. ECHO. Parameter /PARAM2 found! ECHO. (Parameter is "%2")

REM *** Signal 'Parameter is okay' to the calling program REM SET paramOK=1

REM *** and end pass2 REM GOTO $$End1$$

REM -- REM *** exit label for pass1 REM    Housekeeping epilog REM
 * $$End$$

SET sParm= SET sProg=

REM -- REM *** exit label for pass2 REM
 * $$End1$$



Using conditional command execution
For simple tasks you can use the unconditional and the conditional command execution of the CMD.EXE. Note: command1 and command1 can be an internal or external OS/2 command or two or more commands separated with one of the separators. Using parenthesis to group the commands is also possible. (constructions like (c1 && c2) || ( c3 && c4 || c5) are possible)

Examples:  @ECHO OFF REM *** Some examples for conditional command execution REM REM    Note: This commands only work in Batch programs! REM          (because of the format used for the placeholder) REM

REM -- REM *** copy all files in the current directory into the directory REM    .\backup and print a success message for every file REM    successfully copied REM @ECHO OFF for %%d in ( *.* ) DO (     @copy %%d backup\*.* 2>NUL >NUL && ECHO. %%d saved.      )

REM -- REM *** copy all files in the current directory into the directory REM    .\backup and print an error message for every file REM    that couldn't be copied REM @ECHO OFF for %%d in ( *.* ) DO (     @copy %%d backup\*.* 2>NUL >NUL || ECHO. Error copying %%d!      )

REM -- REM *** copy all files in the current directory into the directory REM    .\backup and print a success or an error message for each REM    file depending on the success of the copy command REM @ECHO OFF for %%d in ( *.* ) do (     ( copy %%d backup\*.* 2>NUL >NUL && ECHO. %%d saved. ) || ECHO. Error saving %%d     )

REM -- REM *** create a directory named BACKUP in the current directory, REM    copy all files in the current directory into the directory REM    .\BACKUP, delete all files successfully copied and REM    print a success or an error message for each file REM    depending on the success of the copy and del commands REM REM    Note: Be aware that OS/2 starts a new CMD.EXE for each REM          command string in parentheses! REM REM    Note: Maybe you must read it more than one time to REM           understand what's going on. REM          (or look at the REXX program doing the same) REM @ECHO OFF ECHO. ECHO. Saving the files *.* into the directory .\backup md .\backup 2>NUL >NUL & cd .\backup && ( cd .. & for %%d in ( *.* ) do ( copy %%d backup\*.* 2>NUL >NUL && (    del %%d 2>NUL >NUL && ( ECHO. --- %%d saved and deleted. ) || (        ECHO. -W- %%d saved but not deleted. ) ) || (          ECHO. -E- Error saving %%d ) ) ) || (             ECHO. -E- Error accessing the directory .\backup! ) ECHO.  Note: Keep in mind that the maximum line length handled by the CMD.EXE is 1024!

Sample code for parameter parsing
 @ECHO OFF @REM ***** CatchArg.cmd @REM ***** This is excellent code to parse parameter in Batch files @REM ***** @REM ***** Author: Ralf Ulrich (see EMail Addresses) @REM *****

@setlocal @echo off

REM ***** Change "echo my_Progi" to the name of the program to run set PROGI=echo my_Progi&rem REM ***** &rem prevents from space to be inserted at the end!

REM ***** This variable is used for the valid parameters checked so far set PARAM=&rem

REM ***** This variable is used to save the order of the first 7 parameters set ORDER=$&rem

REM ***** This variables used for --HELP  message! set H1=%0 execs "%PROGI%" only with parameters in special order! set H2="/Arg1 /Arg3"  or "/Arg2 /Arg3"   or "/Arg3 /Arg1"

REM ***** This is the main loop for the parameter processing
 * $Loop

REM ***** check if there is a parameter IF '%1' == '' GOTO $End1

REM ***** Process the next parameter SHIFT

REM ***** If Cmd.exe does not find the label, it shall not output REM ***** the SysError but echo defined Help (H1 & H2). goto X%0 2>NUL || (echo dismissed "%0" &echo %H1% &echo %h2%) REM ***** Or insert a default execution:    (%PROGI% --Help)

REM ***** Insert a label for every possible parameter :X/Arg1 set ORDER=%ORDER%1&rem set PARAM=%PARAM% %0&rem echo accepted "%0" goto $Loop

set ORDER=%ORDER%2&rem set PARAM=%PARAM% %0&rem echo accepted "%0" goto $Loop

set ORDER=%ORDER%3&rem set PARAM=%PARAM% %0&rem echo accepted "%0" goto $Loop


 * $End1

goto %ORDER% 2>NUL || (echo Invalid parameter order, possible: &echo %H2%)

REM ***** Insert a label for every possible parameter order here REM ***** For example you can call this sample with the parameter REM ***** in the following order:

REM ***** CatchArg.cmd /arg1 /arg3
 * $13

REM ***** CatchArg.cmd /arg2 /arg3
 * $23

REM ***** CatchArg.cmd /arg3 /arg1
 * $31

REM ***** all other possible parameter orders are invalid! REM ***** if Cmd.exe does not find a fitting label it executes: REM ***** "echo Invalid parameter order, possible: &echo ..."

REM ***** "PROGI" inserts the main code here: %PROGI%%PARAM% REM ***** Remember the first catch already inserted a space in front of PARAM

REM ***** This label marks the end of the program
 * $End2



CID related information
This section contains some information CID related information.

RSPINST return codes
RSPINST is the program used for the unattended installation of OS/2. When RSPINST encounters an error, it returns a non-zero return code to SEINST. SEINST displays this return code. This section provides a list of the return code definitions.

Source: OSINRMCD.TXT - RSPINST RETURN CODES 09/19/96 an IBM document.

NETBIOS return codes

 * NETBIOS RETURN CODES                         *
 * NETBIOS RETURN CODES                         *

NB_COMMAND_SUCCESSFUL                       EQU       0000H NB_ILLEGAL_BUFFER_LEN                       EQU       0001H NB_INVALID_COMMAND                          EQU       0003H NB_COMMAND_TIME_OUT                         EQU       0005H NB_MESSAGE_INCOMPLETE                       EQU       0006H NB_DATA_NOT_RECEIVED                        EQU       0007H NB_ILLEGAL_LOCAL_SESSION                    EQU       0008H NB_NO_RES_AVAILABLE                         EQU       0009H NB_SESSION_CLOSED                           EQU       000AH NB_COMMAND_CANCELLED                        EQU       000BH NB_DUPLICATE_NAME                           EQU       000DH NB_NAME_TABLE_FULL                          EQU       000EH NB_CMND_CMPL_DEREGISTERED                   EQU       000FH NB_SESSION_TABLE_FULL                       EQU       0011H NB_SES_OPEN_REJECTED                        EQU       0012H NB_ILLEGAL_NAME_NUMBER                      EQU       0013H NB_REMOTE_NAME_NOT_FOUND                    EQU       0014H NB_LOCAL_NAME_NOT_FOUND                     EQU       0015H NB_NAME_IN_USE                              EQU       0016H NB_NAME_DELETED                             EQU       0017H NB_SESSION_ENDED_ABNORMALLY                 EQU       0018H NB_NAME_CONFLICT                            EQU       0019H NB_INTERFACE_BUSY                           EQU       0021H NB_MAX_CMNDS_EXCEEDED                       EQU       0022H NB_INVALID_ADAPTER                          EQU       0023H NB_CMND_ALREADY_COMPLETED                   EQU       0024H NB_CMND_INVALID_TO_CANCEL                   EQU       0026H NB_NAME_DEFINED_BY_OTHERS                   EQU       0030H NB_ENVIRONMENT_NOT_DEFINED                  EQU       0034H NB_NO_OS_RESOURCES                          EQU       0035H NB_MAX_APPL_EXCEEDED                        EQU       0036H NB_NO_SAP_AVAILABLE                         EQU       0037H NB_INADEQUATE_RESOURCES                     EQU       0038H NB_INVALID_NCB_ADDRESS                      EQU       0039H NB_RESET_INVALID                            EQU       003AH NB_INVALID_DD_ID                            EQU       003BH NB_SEGMENT_LOCK_UNSUCCESSFUL                EQU       003CH NB_DD_OPEN_ERROR                            EQU       003FH

NB_OS_ERROR_DETECTED                        EQU       0040H NB_PERM_RING_STATUS                         EQU       004FH

NB_UNEXPECTED_CCB_ERROR                     EQU       00F6H NB_ADAPTER_OPEN_ERROR                       EQU       00F8H NB_ADAPTER_HANDLER_ERROR                    EQU       00F9H NB_ADAPTER_CHECK                            EQU       00FAH

NB_CODE_NOT_OPERATIONAL                     EQU       00FBH NB_OPEN_FAILURES                            EQU       00FCH NB_UNEXPECTED_CLOSE                         EQU       00FDH NB_COMMAND_IN_PROCESS                       EQU       00FFH </PRE>

Undocumented entries for PROGMAN.INI
The following information is from a message in one of the usenet forums:

Add Restrictions for WinOS/2
This might be of some assistance until you find a solution to your security problem. When you get your WinOS2 sessions back in working order, you might be interested in disabling some of its functions by putting some lines in :\OS2\MDOS\WINOS2\PROGMAN.INI. At the bottom of the file (or at the end of any section actually), start a new section called [Restrictions], then try any (or all) of the following lines. [Restrictions] ; EditLevel=4 limits access to changing Groups and Items. EditLevel=4

; NoSaveSettings=1 disables this option. NoSaveSettings=1

; NoRun=1 disables Run on the File menu NoRun=1

; NoFileMenu=1 removes the File menu NoFileMenu=1

; NoClose=1 disable Close from the menus NoClose=1 If you do not use the FileManager, then you can remove its Item icon. It can still be accessed by double clicking its OS/2 icon in the Drives object.

Using redirection with TELNET
To use redirection of STDIN and/or STDOUT for a telnet session use tnpipe.exe instead of telnet.exe, e.g. tnpipe 127.0.0.1 telnet.exe does not handle STDIN correct.

Use only '0A'x as line separator in the input for tnpipe. (see General input line enhancer for an example)

Please note that tnpipe.exe seems to be buggy:

After a number of calls of tnpipe.exe it's not possible to use more than one tnpipe.exe at the same time. The only solution for this problem is to reboot the machine.

Automatically FTP files to or from a client
Source: IBM Technical Document # - 17675356

To automatically FTP files to or from a client do the following:

Create a text file with the FTP commands (see below for an example) Set the environment variable NETRC with the fully qualified name of the file with the commands Enter ftp hostname at the command prompt, for example ftp rs6000

Example for a FTP command file (The machine is rs6000, the userid is bfw720 and the password is noa): machine rs6000 login bfw720 password noa macdef init lcd c:/targetDir cd d:/sourceDir bin get file1.exe ascii get file2.txt bye You can define more than one macro in the file; each macro must begin with machine ... macdef init

Note that you must use the slash / instead of the backslash \ in path names. You can use all known ftp commands in the file (use the command help inside of ftp to get a list of all known commands). To automatically exit ftp after executing the commands the last command in the macro must be bye.

To define different commands for one host use hostname aliase: Add the aliase to the file /etc/hosts like 10.71.24.1     rs6000 rs6000a rs6000b rs6000c and define different macros for each hostname.