REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


Contents of the OS/2 INI files


OS/2 saves a big part of its configuration in the files OS2.INI and 
OS2SYS.INI. Therefore, many of the changes you might make to the WPS with 
REXX will involve changing some entries in these INI files. 
The basic structure of OS/2 INI files is hierarchical, consisting of the 
following elements and order: 

 
  Application
              Key
                  Value


Applications are the main entries. Each application must have at least one 
Key, and each Key must have a Value (Note that a lot of Values - but not 
all - include a trailing NULL byte ['00'x]). This byte may be needed for 
certain values to function properly. It should not be discarded when 
values are modified.) 
To read or change INI file entries in REXX programs you can use the 
REXXUTIL function <SysIni. For example, to read the value of the key 
PDR_DIR of the application PM_INSTALL in the file OS2.INI you can use the 
REXX statement 

 
   pdr_dir = SysIni( 'USER', 'PM_INSTALL', 'PDR_DIR' )
   if pdr_dir = 'ERROR:' then
      say 'Error reading the key from the INI file!'

To change the value of this key you can use 

 
   newPDR_DIR = 'I:\OS2IMAGE' || '00'x
   thisRC = SysIni( 'USER', 'PM_INSTALL', 'PDR_DIR', newPDR_DIR )
   if thisRC = 'ERROR:' then
      say 'Error reading the key from the INI file!'


(BTW: The key used in the example above holds the name of the directory 
with the OS/2 image files (I:\OS2IMAGE) from which the system was 
installed. The value of this key is also the default value for the 
directory containing the OS/2 image if you do a Selective Install. The 
drive letter represents the drive that was used when the system was 
installed; therefore it can differ from one installation to another) 
A detailed description of the contents of the OS/2 INI files (including 
many REXX samples to change the entries) is included in the book OS/2 2.11 
Power Techniques. (Don't mind the version 2.11 in the title - the book is 
also useful for WARP 4). 
Some useful entries are described in the next sections. 
Note that, unless noted otherwise, all entries below have been tested only 
with OS/2 WARP Version 3. 
You can use the program ConvIni.CMD to convert parts or all of an INI file 
into a REXX program to recreate the INI file entries.   

Inf-HTML End Run - Successful