SysIni (Windows only)

>>-SysIni(-+---------+-,app,key,val,stem-)---------------------><
           +-inifile-+

Allows limited access to INI file variables. Variables are stored in the INI file under Application Names and their associated key names or keywords. You can use SysIni to share variables between applications or as a way of implementing GLOBALV in the Windows operating system. Be careful when changing application profile information.

Note: SysIni works on all types of data stored in an INI file (text, numeric, or binary).

When SysIni successfully sets or deletes key values, it returns "". For a successful query, it returns the value of the specified application keyword.

SysIni may return the string ERROR: when an error occurs. Possible error conditions include:

Parameters:

inifile

The name of the INI file with which you would like to work. The default is WIN.INI.

Note: If this argument does not contain a fully qualified file name, the Windows operating system searches for the file in the Windows directory. Therefore to work with a file outside of the Windows directory, specify the full path name of the file.

app

The application name or some other meaningful value with which you want to store keywords (some sort of data).

key

The name of a keyword to hold data.

val

The value to associate with the keyword of the specified application. This can be "DELETE:" or "ALL:".

stem

The name of a Rexx stem variable collection in which to store the resultant information. SysIni sets Rexx variable stem.0 to the number of elements returned and stores these elements in stem.1 to stem.n.

Sysini has six modes. The modes and the syntax variations are as follows:

>>-SysIni(-+---------+-,app,key,val)---------------------------><
                     +-inifile-+

Sets a single key value.

>>-SysIni(-+---------+-,app,key)-------------------------------><
           +-inifile-+

Queries a single key value.

>>-SysIni(-+---------+-,app,key--,"DELETE:"-)------------------><
           +-inifile-+

Deletes a single key.

>>-SysIni(-+---------+-,app-+------------+-)-------------------><
           +-inifile-+      +-,"DELETE:"-+

Deletes an application and all associated keys.

>>-SysIni(-+---------+-,app--,"ALL:"--,"stem"-)----------------><
           +-inifile-+

Queries names of all keys associated with a certain application.

>>-SysIni(-+---------+-,"ALL:"--,"stem"-)----------------------><
           +-inifile-+

Queries the names of all applications.

Examples:

/* 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 WIN.INI file information to the screen  *****/
call SysIni "WIN.INI", "All:", "Apps."
if Result \= "ERROR:" then
do i = 1 to Apps.0
call SysIni "WIN.INI", Apps.i, "All:", "Keys"
if Result \= "ERROR:" then
do j=1 to Keys.0
val = SysIni("WIN.INI", 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
exit