![[About]](r:\html\rexxabout.gif)
![[Toc]](r:\html\rexxtoc.gif)
0.9b (c) 1995 Peter Childs
Function: SysIni
Syntax - Mode 1: Setting single key value.
result = SysIni([inifile], app, key, val)
Syntax - Mode 2: Querying single key value.
result = SysIni([inifile], app, key)
Syntax - Mode 3: Deleting a single key.
result = SysIni([inifile], app, key, 'DELETE:')
Syntax - Mode 4: Deleting an application and all associated keys.
result = SysIni([inifile], app, ['DELETE:'])
Syntax - Mode 5: Querying names of all keys associated with a
certain application.
result = SysIni([inifile], app, 'ALL:', 'stem')
Syntax - Mode 6: Querying names of all applications.
result = SysIni([inifile], 'ALL:', 'stem')
result For successful setting invocations, result will equal ''.
For successful querying invocations, result will be given
the value of the specified application keyword. For
successful deleting invocations, result will equal ''.
The error string 'ERROR:' may be returned if an error
occurs:
Possible error conditions:
o An attempt was made to query or delete an application/key pair
which does not exist.
o An error occurred opening the specified INI file. You may have
specified the current user or system INI file using a relative
filespec. Make sure to use the full filespec, specifying drive,
path, and file name.
inifile The name of the INI file which you would like to work
with. This parameter should be a file specification, or
one of the following:
'USER' The user INI file (usually C:\OS2\OS2.INI). This is
the default.
'SYSTEM' The system INI file (usually C:\OS2\OS2SYS.INI).
'BOTH' For querying invocations, both the user and system
INI files will be searched. For setting invocations,
the user INI file will be written to.
app The application name or some other meaningful value with
which you would like to store keywords (some sort of
data).
key The name of a keyword which is used to hold data.
val The value to associate with the keyword of the specified
application.
stem The name of the stem variable to store the resultant
information in. STEM.0 will be set equal to the number of
elements.
Purpose: This function allows limited editing of INI file variables.
Variables are stored in the INI file under Application Names
and their associated Key Names or keywords. SysIni can be used
to share variables between applications or as a way of
implementing GLOBALV in the OS/2 operating system.
Note: This function works on all types of data stored in an
INI file (text, numeric, or binary).
/* Sample code segments */
/*** Save the user entered name under the key 'NAME' of *****
**** the application 'MYAPP'. ****/
pull name .
call SysIni , 'MYAPP', 'NAME', name /* Save the value */
say SysIni(, 'MYAPP', 'NAME') /* Query the value */
call SysIni , 'MYAPP' /* Delete all MYAPP info */
exit
/**** Type all OS2.INI file information to the screen *****/
call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
call sysloadfuncs
call SysIni 'USER', 'All:', 'Apps.'
if Result \= 'ERROR:' then
do i = 1 to Apps.0
call SysIni 'USER', Apps.i, 'All:', 'Keys'
if Result \= 'ERROR:' then
do j=1 to Keys.0
val = SysIni('USER', Apps.i, Keys.j)
say left(Apps.i, 20) left(Keys.j, 20),
'Len=x'''Left(d2x(length(val)),4) left(val, 20)
end
end
Inf-HTML End Run - Successful