home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
lsmt213c.zip
/
rxutils.inf
(
.txt
)
< prev
next >
Wrap
OS/2 Help File
|
1993-02-19
|
76KB
|
2,939 lines
ΓòÉΓòÉΓòÉ 1. Abstract ΓòÉΓòÉΓòÉ
Acknowledgements
The author would like to thank everyone that participated in the development
and testing of RxUtils.
Persons that were and are especially helpful are listed below:
o Tom Bridgman
o Rick McGuire
ΓòÉΓòÉΓòÉ 2. Introduction ΓòÉΓòÉΓòÉ
RxUtils is a Dynamic Link Library (DLL) which provides the OS/2 REXX programmer
with many versatile functions.
RxUtils was created so that many of the REXX execs which our group has written
could be optimized. Prior to RxUtils, our execs were forced to shell out to
OS/2 and run an executable or internal command. This was very slow and often
caused many lines of code to be written.
(C) IBM Corporation 1989, 1993
ΓòÉΓòÉΓòÉ 3. RxUtils Documentation ΓòÉΓòÉΓòÉ
The RXUTILS SCRIPT is written in Bookmaster. You may script this document to
any host printer which supports Bookmaster via the following command:
SCRIPT RXUTILS SCRIPT ( ON printer BOOKIE
The RXUTILS INFBIN file may be downloaded in binary to your OS/2 workstation as
RXUTILS.INF. This file contains on-line documentation which may be browsed via
the OS/2 VIEW program. To view the documentation, execute the following from
any OS/2 command prompt:
VIEW RXUTILS.INF
ΓòÉΓòÉΓòÉ 4. Requirements ΓòÉΓòÉΓòÉ
RxUtils requires that you are already running under one of the following
environments:
o OS/2 1.20 SE running the latest REXXSAA available from OS2TOOLS.
o OS/2 EE 1.20 with OS/2 Procedures Language 2/REXX installed or OS/2 1.30 or
1.30.1 (SE or EE) with OS/2 Procedures Language 2/REXX installed.
o OS/2 2.0 with OS/2 Procedures Language 2/REXX installed.
ΓòÉΓòÉΓòÉ 5. Contents ΓòÉΓòÉΓòÉ
The RXUTILS PACKAGE contains the following files:
RXTEST CMDBIN - Test exec that uses all RXUTILS functions
RXUTILS ANNOUNCE - Announcement file containing version information
RXUTI32 DLLBIN - OS/2 2.0 specific 32-bit version of RXUTILS.DLL
RXUTI16 DLLBIN - 16-bit version of RXUTILS.DLL. Works for OS/2 1.2+
RXUTILS INFBIN - Online VIEW documentation
RXUTILS SCRIPT - BookManager script file source
Note: Those files whose filetype ends in BIN should be downloaded in binary.
ΓòÉΓòÉΓòÉ 6. Installation ΓòÉΓòÉΓòÉ
For OS/2 1.20, 1.30, 1.30.1 and 2.0 you may use the 16-bit version RXUTILS.DLL.
The 16-bit version is named RXUTI16.DLL and should be renamed RXUTILS.DLL
before use.
For OS/2 2.0 you may use the 32-bit version RXUTILS.DLL. The 32-bit version is
named RXUTI32.DLL and should be renamed RXUTILS.DLL before use.
To use RXUTILS.DLL, you must first copy it to a subdirectory specified in the
LIBPATH statement of your CONFIG.SYS.
Example of installing 16-bit version:
COPY RXUTI16.DLL C:\OS2\DLL\RXUTILS.DLL
Example of installing 32-bit version:
COPY RXUTI32.DLL C:\OS2\APPS\DLL\RXUTILS.DLL
ΓòÉΓòÉΓòÉ 7. Usage ΓòÉΓòÉΓòÉ
To be able to use an RxUtils function in a REXX exec, you must first add the
function via the command RxFuncAdd.
Example: call RxFuncAdd 'RxGrep', 'RXUTILS', 'RXGREP'
The above example would add the RxGrep function so that it can be used.
Note: RxFuncAdd is an internal REXXSAA command. It is not part of RxUtils.
Consult the Procedure Language 2/REXX Reference for further information
regarding RxFuncAdd if needed. If an RXUTILS function is not available after
an RxFuncAdd, you will receive a REXX code 43, Routine not found error. This
is NOT RXUTILS fault. If you receive this error, it is probably due to the
fact that you are incorrectly using the RxFuncAdd function or that RXUTILS.DLL
is not along the LIBPATH. If the Routine not found errors persist, append to
REXXOS2 FORUM on IBMPC as a last resort.
The RxUtils function, RxLoadFuncs, will automatically load all RxUtils
functions. To do this from within an exec, add the following commands:
call RxFuncAdd 'RxLoadFuncs', 'RXUTILS', 'RXLOADFUNCS'
version = RxLoadFuncs()
Note: If the version of the RxUtils functions which were loaded by RxLoadFuncs
is not of interest you may call RxLoadFuncs instead.
RxUtils is also compatible with the RxFncLdr package on OS2TOOLS. RxFncLdr is
an executable which registers all REXX functions within a specified REXX DLL
(such as RXUTILS.DLL and RXSEM.DLL). To use RxFncLdr to register all RxUtils
functions, you could add the following to your STARTUP.CMD:
RXFNCLDR RXUTILS
Note: Special thanks to Patrick J. Mueller for writing RxFncLdr.
Note: The 32-bit version of RXUTILS.DLL does not work with RXFNCLDR. Use the
RxLoadFuncs technique described above instead.
ΓòÉΓòÉΓòÉ 8. RxUtils Definition of a Stem Variable ΓòÉΓòÉΓòÉ
Many of RxUtils functions work with stem variables. These functions are
limited in that they only work with stem variables having the following
characteristics:
o STEM.0 specifies the number of elements in the stem (not counting STEM.0).
o STEM.1 through STEM.x (where x is the value specified by STEM.0) are the only
accessible values.
The RxGrep and RxRead functions read from files and create stem variables of
this type.
The RxStemDelete, RxStemInsert, and RxWrite functions all require stem
variables of this type as input.
The following is sample code which displays the concepts of a stem variable as
it is described above:
/* Sample code */
/* Set the stem variable */
list.0=5
list.1='went to market'
list.2='stayed home'
list.3='had roast beef'
list.4='had none'
list.5='went wee wee wee wee all the way home'
/* Print out a story */
do i=1 to list.0
say 'This little piggy 'list.i
end
/* Output */
This little piggy went to market
This little piggy stayed home
This little piggy had roast beef
This little piggy had none
This little piggy went wee wee wee wee all the way home
ΓòÉΓòÉΓòÉ 9. Miscellaneous Functions Overview ΓòÉΓòÉΓòÉ
ΓòÉΓòÉΓòÉ 9.1. RxAddGroup ΓòÉΓòÉΓòÉ
Function: RxAddGroup
Syntax: rc = RxAddGroup([inifile], group)
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).
group The name of the group to be added (ie 'Main').
Purpose: Add a group to the Start Programs/Desktop Manager window.
RC Return Codes
0 Group addition was successful.
2 Error. Error adding group; It may already exist.
9 Invalid INI file entry. You may have specified the current user
or system INI file via a 'relative' filespec. Make sure to use
the full filespec, specifying drive, path, and file name.
Note:
Groups that "Open when system is started"
OS/2 1.30 supports the concept of groups which automatically open when the
system starts. The RxAddGroup() procedure calls the system function
PrfAddGroup(), which does not support this type of group attribute.
However, one may use the RxOS2Ini() function to make Autoopen groups. For
example; to make the Main group open automatically, the following RxOS2Ini call
should be used:
call RxOS2Ini , 'PM_Autoopen', 'Main', '1'||d2c(0)
ΓòÉΓòÉΓòÉ 9.2. RxAddProgram ΓòÉΓòÉΓòÉ
Function: RxAddProgram
Syntax: rc = RxAddProgram([inifile], group, stem)
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).
group The group in which the program should be added (ie 'Main').
stem A stem variable which describes the program to be added. Stem.0
should be set to the number of stem elements. A stem element may
be any one of the following:
'TITLE=...' The title of the program.
Note: The 'TITLE=...' statement is required.
'TYPE=...' The program type, any one of the following:
'DEFAULT' If used, the system will decide how to run the program.
'FULLSCREEN' The program will be run in a Full Screen OS/2 Window.
'VIOWINDOW' The program will be run in a VIO OS/2 Window.
'PM' The program is a PM application and will be started from the
PM shell.
'REAL' 'The program is a DOS application and will be run from the
DOS box.
'VISIBILITY=...' Either one of the following:
'VISIBLE' The program entry will be displayed in the Desktop Manager
group.
'INVISIBLE' The program entry will not be displayed in the Desktop
Manager group.
'EXE=...' The complete path and filename of the program to be run.
'PARAMS=...' The parameters to be used when running the program.
'WORKDIR=...' The working directory of the program to be run.
'ICONFILE=...' The full path and filename of the icon to be associated
with the program. This is not required if the program to be run
contains an icon resource within it (such as most PM programs
do).
'XYSIZE=x, y, cx, cy' The position and size of the running program. The
values of x and y denote the position of the lower left of the
program's presentation space. While the values of cx and cy
denote the width and height of the presentation space,
respectively. If all values are 0 (the default) the system
will decide the best values for the application.
Note: XYSIZE is really only useful for VIOWINDOW sessions. It
does not affect FULLSCREEN sessions and PM programs have a
tendency to move and size themselves as they desire.
'XYSTYLE=...' Any logical combination of the following:
NORMAL Session will be normal and have none of the styles or
attributes listed below.
NOAUTOCLOSE Upon termination of the running program, the session will
not close automatocally. For VIOWINDOW sessions, the session
is terminated by selecting the System Menu Close menu item
(or by pressing ALT-F4 or by double clicking on the System
Menu).
MINIMIZED The session will start in the minimized state. This only
works for VIOWINDOW sessions.
MAXIMIZED The session will start in the maximized state. This only
works for VIOWINDOW sessions.
INVISIBLE The session will not be seen while executing (but will show
up in the Task List). This only works for VIOWINDOW
sessions.
Note:
Multiple XYSTYLE attributes should be specified with one stem
entry.
For example:
'XYSTYLE=NOAUTOCLOSE, MINIMIZED'
Purpose: Add a program to a particular group in the Start Programs/Desktop
Manager window.
RC Return Codes
0 Program addition was successful.
1 Error. Illegal stem variable item.
2 Error. Not enough memory.
3 Error. Title not specified.
4 Error. Error adding program; It may already exist.
9 Invalid INI file entry. You may have specified the current
user or system INI file via a 'relative' filespec. Make sure
to use the full filespec, specifying drive, path, and file
name.
Note:
Programs that "Open when system is started"
OS/2 1.30 supports the concept of programs which automatically open when the
system starts. The RxAddProgram() procedure calls the system function
PrfAddProgram(), which does not support this type of program attribute.
However, one may use the RxOS2Ini() function to make Autostart programs. For
example; to make the Communications Manager program of the Main group open
automatically, the following RxOS2Ini call should be used:
call RxOS2Ini , 'PM_Autostart', 'Main\Communications Manager', '1'||d2c(0)
ΓòÉΓòÉΓòÉ 9.3. RxAnsi ΓòÉΓòÉΓòÉ
Function: RxAnsi
Syntax: state = RxAnsi([newstate])
state Either 'ON' or 'OFF' depending on the current ANSI state.
newstate The desired ANSI state to be set, either 'ON' or 'OFF'. When
setting the ANSI state the current state prior to the setting is
returned.
Purpose: This function may be used to determine if ANSI is ON or OFF and to
reset the ANSI state to ON or OFF.
ΓòÉΓòÉΓòÉ 9.4. RxBootDrive ΓòÉΓòÉΓòÉ
Function: RxBootDrive
Syntax: drive = RxBootDrive()
drive The drive that OS/2 was booted from (ie C:).
Purpose: With the introduction of OS/2 2.0 and MOST, OS/2 can be installed and
booted from drives other than C:. It is often required that the boot
drive is known. RxBootDrive returns the drive from which OS/2 was
booted.
ΓòÉΓòÉΓòÉ 9.5. RxCls ΓòÉΓòÉΓòÉ
Function: RxCls
Syntax: call RxCls
Purpose: Clears the screen quickly.
ΓòÉΓòÉΓòÉ 9.6. RxCurPos ΓòÉΓòÉΓòÉ
Function: RxCurPos
Syntax: pos = RxCurPos([row, col])
pos The position of the cursor upon the calling of RxCurPos in the
form 'row, col'.
row The row on the screen to move to.
col The column on the screen to move to.
Note: Position (0,0) is at the upper left. You may call RxCurPos
without parameters to check the current cursor position without
changing it.
Purpose: Move the cursor to the specified row and column and/or query the
current/previous cursor position.
Example:
/* Code */
call RxCls
parse value RxCurPos() with row', 'col
say 'Cursor position is 'row', 'col
/* Output */
Cursor position is 0, 0
ΓòÉΓòÉΓòÉ 9.7. RxCurState ΓòÉΓòÉΓòÉ
Function: RxCurState
Syntax: state = RxCurState([newstate])
state The current state of the cursor, either 'ON' or 'OFF'.
newstate The desired state which to set the cursor. Should be one of the
following:
'ON' Display the cursor.
'OFF' Hide the cursor. When setting the cursor state, the current
state prior to the setting is returned.
Purpose: Use this function to hide or display the cursor or to query the
current cursor setting.
ΓòÉΓòÉΓòÉ 9.8. RxDCName ΓòÉΓòÉΓòÉ
Function: RxDCName
Syntax: server = RxDCName(domain)
server The name of the server residing on the domain specified (if any).
Note: If valid, the returned server name will start with '\\'.
domain The domain of interest.
Purpose: Given a domain name, this function returns the name of the domain
controller's server if there is one.
Note: If the domain specified does not exist than the function will
return the string '$RXERROR'.
/* Example */
server = RxDCName('YKCOD02')
say server /* Expect something like '\\YKCOD02S' */
ΓòÉΓòÉΓòÉ 9.9. RxDelete ΓòÉΓòÉΓòÉ
Function: RxDelete
Syntax: rc = RxDelete(file)
Purpose: Deletes the specified file.
RC: Return Codes
0 File deleted successfully.
2 Error. File not found.
3 Error. Path not found.
5 Error. Access denied.
26 Error. Not DOS disk.
32 Error. Sharing violation.
36 Error. Sharing buffer exceeded.
87 Error. Invalid parameter
206 Error. Filename exceeds range error
ΓòÉΓòÉΓòÉ 9.10. RxDeleteGroup ΓòÉΓòÉΓòÉ
Function: RxDeleteGroup
Syntax: rc = RxDeleteGroup([inifile], group)
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).
group The group that should be deleted (ie 'Main').
Purpose: Deletes a specified Desktop Manager group from a specified INI file.
RC: Return Codes
0 Group was deleted successfully.
3 Error. Could not delete group.
4 Error. Group specified does not exist.
9 Invalid INI file entry. You may have specified the current user
or system INI file via a 'relative' filespec. Make sure to use
the full filespec, specifying drive, path, and file name.
ΓòÉΓòÉΓòÉ 9.11. RxDeleteProgram ΓòÉΓòÉΓòÉ
Function: RxDeleteProgram
Syntax: rc = RxDeleteProgram([inifile], group, program)
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).
group The group from which the program should be deleted (ie 'Main').
program The program title to delete (ie OS/2 Window).
Purpose: Deletes a specified program in a specified group from a specified INI
file.
RC: Return Codes
0 Program was deleted successfully.
3 Error. Could not delete program.
4 Error. Program specified does not exist.
9 Invalid INI file entry. You may have specified the current user
or system INI file via a 'relative' filespec. Make sure to use
the full filespec, specifying drive, path, and file name.
ΓòÉΓòÉΓòÉ 9.12. RxDevConfig ΓòÉΓòÉΓòÉ
Function: RxDevConfig
Syntax: result = RxDevConfig(device)
result The result from the query of one of the devices specfied by the
device parameter.
device A string which represents a device or system attribute of
interest. The following device strings are supported:
Device Result
LPT Number of physical printer (LPT) ports in the system
COM Number of physical serial or RS232 (COM) ports in the system
DISKETTES Number of diskette drives in the system
MATHCO Presence of math coprocessor (where 0 = not present, 1 =
present)
SUBMODEL PC Submodel Type (where the return is the system submodel byte
in hex)
MODEL PC Model Type (where the return is the system model byte in
hex)
DISPLAY Display adapter type (where 0 = monochrome mode compatible, 1 =
other)
DESKTOP PM Desktop width and height returned as 'width, height'
Purpose: Use this function to query information on a number of system
devices.
/* Sample Code */
say 'Printer ports='RxDevConfig("LPT")
say 'Com ports='RxDevConfig("COM")
say 'Diskette drives='RxDevConfig("DISKETTES")
say 'Mach Coprocessor='RxDevConfig("MATHCO")
say 'Submodel='RxDevConfig("SUBMODEL")
say 'Model='RxDevConfig("MODEL")
say 'Display='RxDevConfig("DISPLAY")
say 'Desktop Size='RxDevConfig("DESKTOP")
/* Sample output */
Printer ports=1
Com ports=2
Diskette drives=1
Mach Coprocessor=1
Submodel=11
Model=F8
Display=1
Desktop Size=1280, 1024
ΓòÉΓòÉΓòÉ 9.13. RxDirExist ΓòÉΓòÉΓòÉ
Function: RxDirExist
Syntax: rc = RxDirExist(directory)
directory Name of a directory of interest.
Purpose: Tells whether or not the specified directory exists.
RC: Return Codes
0 Directory does not exist.
1 Directory exists.
ΓòÉΓòÉΓòÉ 9.14. RxDriveInfo ΓòÉΓòÉΓòÉ
Function: RxDriveInfo
Syntax: info = RxDriveInfo(drive [, opt])
info Drive information returned in the following form: 'Drive=d:
Label=s Free=n Total=n'. If the drive is not accessible, then
info will equal ''.
drive The drive of interest, ie 'C:'.
opt Output options. More than one option may be specified if
seperated by commas. The following options are valid:
'FSINFO' If specified, File System information will be returned. This
information includes the type of the file system and optionally
any additional file system information for the drive specified.
The default is not to include file system information.
'NOFORMAT' If specified the returned information will not be formatted
with FIELD= text. The position of each piece of data will
remain the same, but each piece of data will not be preceded
with text. This option is useful in making the output easier
to parse. The default is to format the returned string.
Purpose: Gives drive information.
/* Sample Code */
/* Code */
say RxDriveInfo('C:')
say RxDriveInfo('C:', 'FSINFO')
say RxDriveInfo('J:', 'FSINFO')
say RxDriveInfo('C:', 'FSINFO', 'NOFORMAT')
say RxDriveInfo('J:', 'FSINFO', 'NOFORMAT')
/* Output */
Disk=C: Label=TRIGGER_C Free=33392640 Total=83687424
Disk=C: Label=TRIGGER_C Free=33392640 Total=83687424 Type=HPFS
Disk=J: Label=NFS Free=157744128 Total=262127616 Type=NFS FSdata=yktup01:d:\world
C: TRIGGER_C 33392640 83687424 HPFS
J: NFS 157744128 262127616 NFS yktup01:d:\world
ΓòÉΓòÉΓòÉ 9.15. RxDriveMap ΓòÉΓòÉΓòÉ
Function: RxDriveMap
Syntax: map = RxDriveMap([drive], [opt])
map A string containing all accessible drives.
drive Drive letter with which to start the drive map. The default is
'C'.
opt The drivemap report option. May be any one of the following:
'USED' Report drives which are accessible or in use. This is the
default. This includes all local and remote drives.
'FREE' Report drives which are free or not in use.
'LOCAL' Reports only those drives which are local drives.
'REMOTE' Reports only those drives which are remote drives; such as
redirected LAN resources, IFS attached drives, etc.
'DETACHED' Report drives which are detached LAN resources.
Purpose: Reports all accessible drives in the form 'C: D: E:...'
Example:
/* Code */
say 'Used drives include:'
say RxDriveMap('C:', 'USED')
/* Output */
Used drives include:
C: D: E: F: W:
ΓòÉΓòÉΓòÉ 9.16. RxDropFuncs ΓòÉΓòÉΓòÉ
Function: RxDropFuncs
Syntax: call RxDropFuncs
Purpose: Use this function to drop all the loaded RxUtils functions. Once
this function is executed by a REXX exec, the RxUtils functions will
not be accessible in any OS/2 sessions.
ΓòÉΓòÉΓòÉ 9.17. RxFileExist ΓòÉΓòÉΓòÉ
Function: RxFileExist
Syntax: RxFileExist(filename)
filename Name of a file of interest.
Purpose: Tells whether or not the specified file exists.
RC: Return Codes
0 File does not exist.
1 File exists.
ΓòÉΓòÉΓòÉ 9.18. RxGetKey ΓòÉΓòÉΓòÉ
Function: RxGetKey
Syntax: key = RxGetKey([opt], [seconds])
key The key which was pressed.
opt Any one of the following:
'ECHO' Echo the typed character (Default)
'NOECHO' Do not echo the typed character
seconds Number of seconds to wait for keystroke before aborting. If no
keystroke is received before this timeout or if the user presses
CTRL-BREAK then a null string is returned.
Note: Actual number of seconds before timeout will be a fraction
of a second less than the specified timeout. If you need more
accuracy then you probably shouldn't be using REXX.
Purpose: Gets the next key from the keyboard buffer, or waits for one if none
exist. Works similiar to the C function getch().
ΓòÉΓòÉΓòÉ 9.19. RxGetMessage ΓòÉΓòÉΓòÉ
Function: RxGetMessage
Syntax: msg = RxGetMessage(num, [file] [str1],...[str9])
msg The message associated with the number given.
num The message number.
file The message file to be searched. The default message file is
OSO001.MSG. Message files will be searched for in the system root
directory (ie C:\), the current directory, and along the DPATH.
str1,...str9 Insertion text variables. If the message contains insertion
fields designated by %x, in the range %1 to %9, then the optional
parameters str1 through str9 may be used to designate the
replacement strings.
Purpose: This function can be used to query a message from a specified message
file given a message number. Optionally, insertion text strings may
be specified that will be inserted into the returned message wherever
appropriate. Please see documentation in the OS/2 Programmer's
Toolkit regarding the MKMSGF utility if needed for further
information on message files, their use, and their creation.
/*** Sample code segment using RxGetMessage and insertion text vars ***/
msg = RxGetMessage(34, , 'A:', 'the diskette labeled "Disk 2"', 'SER0002')
say msg
/** Output **/
The wrong diskette is in the drive.
Insert the diskette labeled "Disk 2" (Volume Serial Number: SER0002)
into drive A:.
ΓòÉΓòÉΓòÉ 9.20. RxGrep ΓòÉΓòÉΓòÉ
Function: RxGrep
Syntax: call RxGrep target, file, stem, [options], [scol], [ecol]
target The string to search for.
file The file to search.
stem The name of the stem variable to place the results.
Note: stem.0 contains the number of lines found.
options Any logical combination of the following:
C Case sensitive search.
N Give line numbers when reporting hits.
I Find all lines which do not contain the target string.
Note: Default is to find lines containing the target string in
a case insensitive manner without reporting line numbers.
scol The starting column of the search. The default is 1, which
indicates the first character of each line.
ecol The ending column of the search. The default is the last
character of each line.
Purpose: Finds all lines in specified file which contain a specified target
string, and places said lines in a stem variable.
RC: Return Codes
0 Successful.
2 Error. Not enough memory.
3 Error. Error opening file.
Example: call RxGrep 'DEVICE', 'c:\config.sys', 'file', 'CN'
Examples:
/* Find DEVICE statements in CONFIG.SYS */
call RxGrep 'DEVICE', 'C:\CONFIG.SYS', 'file.'
do i=1 to file.0
say file.i
end
/* Output */
DEVICE=C:\OS2\DOS.SYS
DEVICE=C:\OS2\PMDD.SYS
DEVICE=C:\OS2\COM02.SYS
SET VIDEO_DEVICES=VIO_IBM8514A
SET VIO_IBM8514A=DEVICE(BVHVGA,BVH8514A)
DEVICE=C:\OS2\POINTDD.SYS
DEVICE=C:\OS2\MSPS202.SYS
DEVICE=C:\OS2\MOUSE.SYS TYPE=MSPS2$
/* Find DEVICE statements in CONFIG.SYS (along with line nums) */
call RxGrep 'DEVICE', 'C:\CONFIG.SYS', 'file.', 'N'
do i=1 to file.0
say file.i
end
/* Output */
20 DEVICE=C:\OS2\DOS.SYS
21 DEVICE=C:\OS2\PMDD.SYS
22 DEVICE=C:\OS2\COM02.SYS
33 SET VIDEO_DEVICES=VIO_IBM8514A
34 SET VIO_IBM8514A=DEVICE(BVHVGA,BVH8514A)
40 DEVICE=C:\OS2\POINTDD.SYS
41 DEVICE=C:\OS2\MSPS202.SYS
42 DEVICE=C:\OS2\MOUSE.SYS TYPE=MSPS2$
ΓòÉΓòÉΓòÉ 9.21. RxInsMessage ΓòÉΓòÉΓòÉ
Function: RxInsMessage
Syntax: result = RxInsMessage(string, [str1],...[str9])
result The new string created from supplied string with text variables
inserted in place of %1, %2, etc.
string The template string which should contain a various number of
insertion text variable designators (%1, %2, etc).
str1,...str9 Insertion text variables. If the string parameter contains
insertion fields designated by %x, in the range %1 to %9, then the
optional parameters str1 through str9 should be used to designate
the replacement strings.
Purpose: Use this function to create a text string given specified insertion
strings and a template string.
/* Sample Code */
/* Setup label stem elements and drive letter variable */
label.0=3
label.1='Install'
label.2='Disk 1'
label.3='Disk 2'
drive = 'A:'
do i=1 to label.0
say RxInsMessage('Please insert the diskette labeled "%1" into the %2 drive...',,
label.i, drive)
end
/** Output **/
Please insert the diskette labeled "Install" into the A: drive...
Please insert the diskette labeled "Disk 1" into the A: drive...
Please insert the diskette labeled "Disk 2" into the A: drive...
ΓòÉΓòÉΓòÉ 9.22. RxListFuncs ΓòÉΓòÉΓòÉ
Function: RxListFuncs
Syntax: call RxListFuncs list
list A list of all RxUtils functions, seperated by spaces.
Purpose: Use this function to get a list of all functions.
/*** Sample code segment which adds all functions via RxFuncAdd ***/
call RxFuncAdd 'RxListFuncs', 'RXUTILS', 'RXLISTFUNCS'
call RxListFuncs 'list'
do until list=''
parse var list func list
say 'Adding 'func'...'
call RxFuncAdd func, 'RXUTILS', translate(func)
end
ΓòÉΓòÉΓòÉ 9.23. RxLoadFuncs ΓòÉΓòÉΓòÉ
Function: RxLoadFuncs
Syntax: ver = RxLoadFuncs(['QUIET'])
ver The version of the RxUtils functions that were loaded.
Purpose: Use this function to load all RxUtils functions so that each function
will be accessible. To suppress the copyright notice, call
RxLoadFuncs with the 'QUIET' parameter
/*** Sample which adds all functions via RxLoadFuncs ***/
say 'Loading RxUtils functions...'
call RxFuncAdd 'RxLoadFuncs', 'RXUTILS', 'RXLOADFUNCS'
ver = RxLoadFuncs()
say 'RxUtils version 'ver' loaded.'
ΓòÉΓòÉΓòÉ 9.24. RxMkDir ΓòÉΓòÉΓòÉ
Function: RxMkDir
Syntax: rc = RxMkDir(dirspec)
dirspec The directory which should be created.
Purpose: Creates a specified directory quickly. In case of failure, one of
many return codes are given so that the exact reason for failure may
be determined.
RC: Return Codes
0 Directory creation was successful.
2 Error. File not found.
3 Error. Path not found.
5 Error. Access denied.
26 Error. Not a DOS disk.
87 Error. Invalid parameter.
108 Error. Drive locked.
206 Error. Filename exceeds range.
Example: call RxMkDir 'c:\rexx'
ΓòÉΓòÉΓòÉ 9.25. RxOS2Ini ΓòÉΓòÉΓòÉ
Function: RxOS2Ini
Syntax - Mode 1: Setting single key value.
result = RxOS2Ini([inifile], app, key, val)
Syntax - Mode 2: Querying single key value.
result = RxOS2Ini([inifile], app, key)
Syntax - Mode 3: Deleting a single key.
result = RxOS2Ini([inifile], app, key, '$RXDEL')
Syntax - Mode 4: Deleting an app and all associated keys.
result = RxOS2Ini([inifile], app, ['$RXDEL'])
Note: Due to previous version syntax, the '$RXDEL' parameter is
optional.
Syntax - Mode 5: Querying names of all keys associated with a certain app.
result = RxOS2Ini([inifile], app, '$RXALL', 'stem')
Syntax - Mode 6: Querying names of all apps.
result = RxOS2Ini([inifile], '$RXALL', '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 following error strings may be returned if an error occurs:
o '$RXERROR'
Returned if error occurs in setting, querying, or deleting then result
will equal '$RXERROR'.
o '$INI_ERROR'
Returned if error occurs in opening the specified INI file. You may
have specified the current user or system INI file via 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 functions allows limited editing of INI file variables.
Variables are stored in the INI file under 'Application Names' and
their associated 'Key Names' or keywords. RxOS2Ini can be used to
share variables between applications or as a way of implementing
GLOBALV under OS/2.
Note: This function will work on all types if data stored in an INI
file (ie text, numeric, binary), therefore be careful!
/* Sample code segments */
/*** Save the user entered name under the key 'NAME' of the *****
**** application 'MYAPP'. ****/
pull name .
call RxOS2Ini , 'MYAPP', 'NAME', name /* Save the value */
say RxOS2Ini(, 'MYAPP', 'NAME') /* Query the value */
call RxOS2Ini , 'MYAPP' /* Delete all MYAPP info */
exit
/*** Type all OS2INI file information to the screen *****/
call RxOS2INI , '$RXALL', 'Apps' /* Stem Var=Apps */
if Result<>'$RXERROR' then
do i=1 to Apps.0
call RxOS2INI , Apps.i, '$RXALL', 'Keys' /* Stem Var=Keys */
if Result<>'$RXERROR' then
do j=1 to Keys.0
val = RxOS2INI( , 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
ΓòÉΓòÉΓòÉ 9.26. RxOS2Ver ΓòÉΓòÉΓòÉ
Function: RxOS2Ver
Syntax: ver = RxOS2Ver()
ver String containing OS/2 version info in the form 'x.xx'
Purpose: Returns the OS/2 version information.
ΓòÉΓòÉΓòÉ 9.27. RxPasswordAge ΓòÉΓòÉΓòÉ
Function: RxPasswordAge
Syntax: age = RxPasswordAge(domain, userid)
age The age in days of the specified userid's password on the
specified domain or the totals number of days a password is
allowed before it expires (see userid parameter for details).
domain The domain of interest.
Note: If the domain is not accessible then
'$RXERROR_NO_SUCH_DOMAIN' will be returned.
userid The userid of interest OR to determine the expiration period on a
given domain, replace the userid parameter with '$RXEXPIRES'.
Note:
If the userid is not known to the domain then
'$RXERROR_NO_SUCH_USER' will be returned.
If the expiration period is queried on a server which does not
have a set expiration period, '$RXERROR_NO_EXPIRATION' is
returned.
Purpose: Given a domain name, and a userid, this function will return the age
of the users password on said domain in days. This function may also
be used to determine the expiration period on a given domain.
Example:
/* Code */
parse value RxUserInfo() with uid mach domain
age = RxPasswordAge(domain, uid)
expires = RxPasswordAge(domain, '$RXEXPIRES')
say 'Age of 'uid'''s password on 'domain' is 'age' day(s).'
if left(expires, 1)='$' then
say uid'''s password on 'domain' does not expire.'
else
say uid'''s password on 'domain' expires in 'expires-age' day(s).'
/* Output */
Age of ROY's password on YKCOD02 is 3 days.
ROY's password on YKCOD02 does not expire.
ΓòÉΓòÉΓòÉ 9.28. RxPause ΓòÉΓòÉΓòÉ
Function: RxPause
Syntax: call RxPause [prompt]
prompt The message to give the user. The default message is 'Press any
key when ready...'
Purpose: Similar to OS/2 PAUSE. Waits for the user to press a key before
continuing. Also allows for optional prompt.
ΓòÉΓòÉΓòÉ 9.29. RxPriority ΓòÉΓòÉΓòÉ
Function: RxPriority
Syntax - Mode 1: Quering current priority
result = RxPriority()
Syntax - Mode 2: Setting Priority Class and Priority Level
result = RxPriority(PriorityClass [,PriorityDelta])
result
In the case of the querying of the current priority, result will
be set to a string containing the current Priority Class followed
by a comma, followed by a space, followed by the current Priority
Level.
In the case of setting the priority of the current process, the
result will be an empty string in the case of success, else the
string 'ERROR:n' where n is the return code of the failing
DosSetPrty() function.
PriorityClass
Priority class of a process. The values and descriptions are:
Value Definition
0 No change, leave as is
1 Idle-time
2 Regular
3 Time-critical.
4 Fixed-high.
PriorityDelta
Delta priority to apply to the process's current base priority
level. This value must range from -31 to +31.
Purpose:
The RxPriority function uses the DosGetPrty() function when querying
the current process priority and the DosSetPrty() when setting the
current process priority. The following documentation has been
excerpted from the OS/2 Toolkit Documentation and should be used to
better understand the setting of process priorities.
The OS/2 scheduler has a concept of priority classes and levels.
DosSetPrty allows threads to move between classes in response to
changes in their execution environments. Within each class, a
thread's priority level can vary because of a DosSetPrty request or
action taken by the system. System-initiated priority variation is
performed as a combination of a specific thread's actions and the
overall system activity.
A time-critical thread has the highest priority class and executes
before any fixed-high, regular, or idle-time threads. A fixed-high
thread has a priority class that is lower than time-critical but
executes before any regular or idle-time threads.
Time-critical threads have static priorities that are not varied by
OS/2. Threads are scheduled in priority order, with round-robin
scheduling of threads of equal priority.
For each of the four priority classes, there are 32 distinct priority
levels, 0 to +31. Whenever DosSetPrty is issued with a class
specification, but no value is specified for PriorityDelta, the base
priority level defaults to zero.
The priority level of a process consists of a computed priority value
that is based upon the display status (foreground or background) of
the process, its recent I/O and processor time-usage history, and
other factors. The signed value specified in PriorityDelta is added
to the computed priority to produce the actual priority used by the
scheduler. The result is restricted to the valid range, based upon
the current priority class.
Specifying a higher priority delta allows a thread to obtain better
processor scheduling than it normally would. A lower priority delta
gives the thread less processor resource than it normally receives.
When used with PriorityClass to change to a different class, the
delta value applies to the base priority. A new base level of 0 is
assigned the target thread and any PriorityDelta specified is
relative to zero.
/* Example which queries and sets priority */
parse value RxPriority() with pClass', 'pLevel
say 'Current process Priority Class='pClass' and Priority Level='pLevel
say
say 'Incrementing Priority Level by 10...'
call RxPriority 0, 10
parse value RxPriority() with pClass', 'pLevel
say 'Current process Priority Class='pClass' and Priority Level='pLevel
say
say 'Setting process Priority Class to Fixed-High...'
call RxPriority 4, 1
parse value RxPriority() with pClass', 'pLevel
say 'Current process Priority Class='pClass' and Priority Level='pLevel
/* Output from above code */
Current process Priority Class=2 and Priority Level=0
Incrementing Priority Level by 10...
Current process Priority Class=2 and Priority Level=10
Setting process Priority Class to Fixed-High...
Current process Priority Class=4 and Priority Level=1
ΓòÉΓòÉΓòÉ 9.30. RxProcessType ΓòÉΓòÉΓòÉ
Function: RxProcessType
Syntax: type = RxProcessType()
type The type of the current process. The type is returned as a
number. Valid types are:
Type Description
0 Full screen protect mode session.
1 Requires real mode.
2 VIO windowable protect mode session.
3 Presentation Manager protect mode session.
4 Detached protect mode process.
Purpose: Use this function to determine the type of the session which the
REXXSAA interpreter is executing in. This is often useful as you
sometimes want your code to perform different tasks if running in a
detached session of under the control of a PM program such as PMREXX.
/* Sample Code */
/* Get process type */
ptype = RxProcessType()
/* If not a PM or Detached session then do screen I/O stuff */
if ptype<>3 & ptype<>4 then do
/* etc, etc */
end
ΓòÉΓòÉΓòÉ 9.31. RxQueryGroup ΓòÉΓòÉΓòÉ
Function: RxQueryGroup
Syntax: rc = RxQueryGroup([inifile], group, stem)
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).
group The group from which program title information is to be queried
(ie 'Main').
Note: If group='ROOT_GROUP' then the titles of all the groups of
the Start Programs/Desktop Manager will be returned.
stem The name of the stem variable in which the program titles for the
specified group will be stored. Stem.0 will be set to the number
of titles, stem.1 will contain the title of the first program,
etc.
Note: stem.0 contains the number of lines read.
Purpose: Get all the program titles contained in a given Group in the Start
Propgrams/Desktop Manager.
RC: Return Codes
0 Query was successful.
2 Error. Not enough memory.
4 Error. Group specified does not exist.
9 Invalid INI file entry. You may have specified the current user
or system INI file via a 'relative' filespec. Make sure to use
the full filespec, specifying drive, path, and file name.
/* Sample Code Segment */
call RxQueryGroup , 'Main', 'MainProgram'
do i=1 to MainProgram.0
say MainProgram.i
end
/* OutPut */
OS/2 Window
OS/2 Full Screen
OS/2 Programming Reference
OS/2 System Editor
OS/2 Command Reference
OS/2 LAN Command Reference
File Manager
Print Manager
LAN Requester
LAN Messaging
Communications Manager
ΓòÉΓòÉΓòÉ 9.32. RxQueryProgram ΓòÉΓòÉΓòÉ
Function: RxQueryProgram
Syntax: rc = RxQueryProgram([inifile], group, program, stem)
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).
group The title of the group in which the program resides (ie 'Main').
program The title of the program of interest.
stem A stem variable in which the program information will be returned.
The value of stem.0 is 9, and stem.1 through stem.9 are the
following:
'TITLE=...' The title of the program.
'TYPE=...' The program type, any one of the following:
'DEFAULT' The system decides how to run the program.
'FULLSCREEN' The program will be run in a Full Screen OS/2 Window.
'VIOWINDOW' The program will be run in a VIO OS/2 Window.
'PM' The program is a PM application and will be started from the
PM shell.
'REAL' 'The program is a DOS application and will be run from the
DOS box.
Note: Supported by OS/2 1.2+ only.
'VISIBILITY=...' Either one of the following:
'VISIBLE' The program entry is displayed in the Desktop Manager group.
'INVISIBLE' The program entry is displayed in the Desktop Manager
group.
'EXE=...' The complete path and filename of the program.
'PARAMS=...' The parameters to be used when running the program.
'WORKDIR=...' The working directory of the program.
'ICONFILE=...' The full path and filename of the icon associated with the
program.
'XYSIZE=x, y, cx, cy' The position and size of the running program. The
values of x and y denote the position of the lower left of the
program's presentation space. While the values of cx and cy
denote the width and height of the presentation space,
respectively. If all values are 0 (the default) the system
decides the best values for the application.
'XYSTYLE=...' Any logical combination of the following:
NORMAL Session is normal and has none of the styles or attributes
listed below.
NOAUTOCLOSE Upon termination of the running program, the session will
close automatocally. For VIOWINDOW sessions, the session is
terminated by selecting the System Menu Close menu item (or
by pressing ALT-F4 or by double clicking on the System
Menu).
MINIMIZED The session starts in the minimized state.
MAXIMIZED The session starts in the maximized state.
INVISIBLE The session is not seen while executing (but does show up in
the Task List).
Note:
Multiple XYSTYLE attributes can be returned in one stem entry.
For example:
'XYSTYLE=NOAUTOCLOSE, MINIMIZED'
Purpose: This function returns inforamtion about a program entry in a
certain group in the Start Programs/Desktop Manager window.
RC Return Codes
0 Program information query was successful.
2 Error. Not enough memory.
4 Error. Program specified does not exist.
9 Invalid INI file entry. You may have specified the current
user or system INI file via a 'relative' filespec. Make sure
to use the full filespec, specifying drive, path, and file
name.
ΓòÉΓòÉΓòÉ 9.33. RxRead ΓòÉΓòÉΓòÉ
Function: RxRead
Syntax: rc = RxRead(filename, stem)
filename The name of the file to read.
stem The name of the stem to place the file in.
Note: stem.0 contains the number of lines read.
Purpose: Reads a specified file into a stem variable.
RC: Return Codes
0 File read was successful.
2 Error. Not enough memory.
3 Error. Error opening file.
4 Error. Error reading file.
Example: call RxRead 'c:\config.sys', 'file'
ΓòÉΓòÉΓòÉ 9.34. RxReadScreen ΓòÉΓòÉΓòÉ
Function: RxReadScreen
Syntax: string = RxReadScreen(row, col, [len])
row The row from which to start reading.
col The col from which to start reading.
len The number of characters to read. The default is read up to the
end of the screen.
string The characters read from the screen. This includes CR and LF
characters which comprise the end of lines should the number of
character read span multiple lines.
Purpose: Reads a specified number of characters from a specified location of
the screen.
Limitations This function only reads in characters and does not consider the
color attributes of each character read. When restoring the character string
to the screen via say or RxSay the previous color settings will be lost.
/* Example which reads in the entire screen */
screen = RxReadScreen( 0, 0 )
/* Example which reads in one line */
line = RxReadScreen( 2, 0, 80 )
ΓòÉΓòÉΓòÉ 9.35. RxRmDir ΓòÉΓòÉΓòÉ
Function: RxRmDir
Syntax: rc = RxRmDir(dirspec)
dirspec The directory which should be deleted.
Purpose: Deletes a specified directory quickly. In case of failure, one of
many return codes are given so that the exact reason for failure may
be determined.
RC: Return Codes
0 Directory removal was successful.
2 Error. File not found.
3 Error. Path not found.
5 Error. Access denied.
16 Error. Current directory.
26 Error. Not a DOS disk.
87 Error. Invalid parameter.
108 Error. Drive locked.
206 Error. Filename exceeds range.
Example: call RxRmDir 'c:\rexx'
ΓòÉΓòÉΓòÉ 9.36. RxRun ΓòÉΓòÉΓòÉ
Function: RxRun
Syntax: rc = RxRun(command, [stem, tempfile])
rc The return code of the executed command.
command The OS/2 command to be run along with any needed arguments.
stem The name of the stem variable in which to place the output of the
executed command. If a stem name is specified, a temporary output
file must also be specified.
tempfile The file name to be used to temporarily store the output of the
command. This file must be able to be created by the running
process and should be on a disk with adequate free space. The
file will be deleted once processed. The standard error and
standard output data streams will be redirected to this file, so
make sure not to redirect either of these in your command. Only
non-interactive commands should be redirected.
Purpose: Executes a specified OS/2 command and retains the return code. The
output of the command may be placed in a specified stem variable if
needed.
RC: The return code of the executed command.
/* Sample Code */
BD = RxBootDrive()
call RxRun 'dir 'BD'\*.*', 'stem.', BD'\temp.fil'
do i=1 to stem.0
say stem.i
end
ΓòÉΓòÉΓòÉ 9.37. RxSay ΓòÉΓòÉΓòÉ
Function: RxSay
Syntax call RxSay string
string Anything you want to be printed to the screen.
Purpose: RxSay works like the REXX 'say' command but does not produce a
newline. Great for prompts.
ΓòÉΓòÉΓòÉ 9.38. RxScreenSize ΓòÉΓòÉΓòÉ
Function: RxScreenSize
Syntax result = RxScreenSize()
result The size of the screen. The format of the result string is 'row,
col'.
Purpose: This function returns the size of the screen.
/* Example */
parse value RxScreenSize() with row', 'col
say 'Rows='row', Columns='col
ΓòÉΓòÉΓòÉ 9.39. RxSearchPath ΓòÉΓòÉΓòÉ
Function: RxSearchPath
Syntax: filespec = RxSearchPath(path, filename)
filespec The complete filespec of the file found, or '' if the filename was
not located along the path.
path Any environment variable that resembles a path, or 'LIBPATH'.
filename The file to search the path for.
Purpose: Searches the specified path for the specified file and returns the
full filespec of the file if found, else returns ''.
Example:
/* Code */
fspec = RxSearchPath('PATH', 'CMD.EXE')
say fspec
/* Output */
C:\OS2\CMD.EXE
ΓòÉΓòÉΓòÉ 9.40. RxSem ΓòÉΓòÉΓòÉ
Function: RxSem
Syntax: rc = RxSem(semname, action, [msecs])
semname The semaphore name to be worked with. Semaphore names must start
with '\SEM\'. If the semaphore name does not start with '\SEM\'
and is a valid numerical value then it will be assumed that it is
a semaphore handle. Only valid semphore handles returned by the
CREATE2 action should be used.
action Any one of the following:
'CLOSE' Close a semaphore previously created by CREATE2.. The semname
parameter specified must be a valid semaphore handle.
'CREATE' Create the semaphore if it does not already exist.
'CREATE2' Just like CREATE, but instead of returning a regular return
code, the handle of the semaphore which was created will be
returned. This handle looks like a numeric string. The handle
returned may be used in place of the semname parameter in all
actions except for CREATE and CREATE2.
'SET' Set the semaphore if it can be set.
'CLEAR' Clear the semaphore if it can be cleared.
'WAIT' Wait until the specified semaphore is cleared. When using WAIT,
the third argument (msecs) specifies the timeout factor.
msecs Any of the following:
-1 Wait indefinitely.
0 Do not wait, timeout immediately (default).
>0 Wait specified time then timeout.
Limitations So that semaphores could be closed, the CREATE2 and
CLOSE actions were added to RxSem. These actions added to RxSem
the concept of a semaphore handle. A semaphore handle is really
just a numerical value which is a FAR Pointer to a memory
location. Keep this in mind! If you call RxSem with an invalid
semaphore handle, a TRAP-D or Protection Violation is sure to
result.
Purpose: RxSem provides an interface to using OS/2 system semaphores.
Semaphores provide a convenient vehicle in which separate processes
may determine the states of one another.
RC: Return Codes
0 Successful.
6 Error. Invalid semaphore handle.
95 Error. Wait interrupted.
100 Error. Create failed. Too many semaphores.
101 Error. Exclusive semaphore already owned.
102 Error. Cannot close set semaphore.
121 Error. Wait timed out.
123 Error. Invalid semaphore name.
183 Error. Semaphore already exists.
187 Error. Semaphore name not found.
/** Example **/
semHandle = RxSem('\SEM\MYAPP', 'CREATE2')
call RxSem semHandle, 'SET'
/* Start of critical code segment */
/* blah, blah, blah */
/* End of critical code segment */
call RxSem semHandle, 'CLEAR'
call RxSem semHandle, 'CLOSE'
ΓòÉΓòÉΓòÉ 9.41. RxSleep ΓòÉΓòÉΓòÉ
Function: RxSleep
Syntax: call RxSleep secs
secs The number of seconds to sleep.
Purpose: Sleep a specified number of seconds.
ΓòÉΓòÉΓòÉ 9.42. RxStemDelete ΓòÉΓòÉΓòÉ
Function: RxStemDelete
Syntax: rc = RxStemDelete(stem, num)
stem The name of the stem to work with.
num The stem element to delete.
Note: If the stem name is 'FILE' and the value of num is '5' then
'FILE.5' will be deleted.
Purpose: Delete or remove a stem element then compact the stem.
ΓòÉΓòÉΓòÉ 9.43. RxStemGrep ΓòÉΓòÉΓòÉ
Function: RxStemGrep
Syntax: call RxStemGrep target, source, hits, [options], [scol], [ecol]
target The string to search for.
source The name of the source stem variable to search.
hits The name of the stem variable to place the results.
Note: hits.0 contains the number of lines found.
options Any logical combination of the following:
C Case sensitive search.
N Give element numbers when reporting hits.
I Find all elements which do not contain the target string.
Note: Default is to find elements containing the target string
in a case insensitive manner without reporting element numbers.
scol The starting column of the search. The default is 1, which
indicates the first character of each line.
ecol The ending column of the search. The default is the last
character of each line.
Purpose: Finds all elements in a specified stem which contain a specified
target string, and places said elements in a specified stem variable.
RC: Return Codes
0 Successful.
2 Error. Not enough memory.
/** Example **/
call RxRead 'c:\config.sys', 'file'
call RxStemGrep 'DEVICE', 'file', 'grep', 'CN'
ΓòÉΓòÉΓòÉ 9.44. RxStemInsert ΓòÉΓòÉΓòÉ
Function: RxStemInsert
Syntax: call RxStemInsert stem, num, val
stem The name of the stem to work with.
num The stem element which will be inserted.
Note: If the stem name is 'FILE' and the value of num is '5',
then val will be inserted as 'FILE.5'. All values from the
original 'FILE.5' to the last element will be moved up one.
Purpose: Inserts or adds a stem element then expands the stem.
RC: Return Codes
0 Successful.
2 Error. Not enough memory.
ΓòÉΓòÉΓòÉ 9.45. RxStemSort ΓòÉΓòÉΓòÉ
Function: RxStemSort
Syntax: call RxStemSort stem, [opt], [scol], [ecol]
stem The name of the stem to sort. Due to the fact that RXUTILS is
currently a 16-bit DLL, and therefore restricted to a segmented
memory architecture, the stem to be sorted must be limited to a
maximum of 16383 elements.
opt The sorting option. May be either of the following:
'A' Ascending sort (default).
'D' Descending sort.
scol The starting column of the sort. The default is 1, which
indicates the first character of each stem element.
ecol The ending column of the sort. The default is the last character
of each stem element.
Note: RxStemSort uses the Quicksort algorithm. Due to the nature
of this alogrithm, any previous order in a given stem is lost.
Therefore, always make sure that the scol and ecol parameters
create substrings for each stem element. If this is not the case,
spurious results may occur.
Purpose: Sorts a stem quickly via the Quicksort algorithm.
RC: Return Codes
0 Successful.
2 Error. Not enough memory. Either out of memory and swap space or
a stem with more than 16383 elements was specified.
ΓòÉΓòÉΓòÉ 9.46. RxSysLevel ΓòÉΓòÉΓòÉ
Function: RxSysLevel
Syntax: result = RxSysLevel([file] [,option])
result The result of the SYSLEVEL query.
file A full qualified SYSLEVEL.xxx file to be processed. Information
regarding the name of the component that the file corresponds to,
as well are current and previous Corrective Service levels are
contained in the file.
If no file is specified, then the default file to be processed is
the \OS2\INSTALL\SYSLEVEL.OS2 file found on the drive from which
the system was booted.
option If no option parameter is specified all information contained in
the SYSLEVEL file will be returned as the result. See the example
below for the format of the result when all information is
queried.
You may also query the information one field at a time by
providing a valid option. Valid options include:
Option Description
LEVEL Returns the current Corrective Service level of the component
PREV_LEVEL Returns the previous Corrective Service level of the component
COMPONENT Returns the name of the component
VER Returns operating system version level of the component
EDITION Returns editon type (either 'Standard Edition' or 'Extended
Edition')
Purpose: This function parses information from a specified SYSLEVEL.xxx
file. It is often necessary to create REXX execs that are able to
determine the Corrective Service level of a particular OS/2
component.
/* Sample code */
file = 'c:\cmlib\syslevel.acs'
say RxSysLevel(file)
say RxSysLevel(file, 'LEVEL')
say RxSysLevel(file, 'PREV_LEVEL')
say RxSysLevel(file, 'COMPONENT')
say RxSysLevel(file, 'VER')
say RxSysLevel(file, 'EDITION')
/* Output */
WR05015 WR05001 Extended Edition 1.30.1 IBM OS/2 Communications Manager
WR05015
WR05001
IBM OS/2 Communications Manager
1.30.1
Extended Edition
ΓòÉΓòÉΓòÉ 9.47. RxTempFileName ΓòÉΓòÉΓòÉ
Function: RxTempFileName
Syntax: file = RxTempFileName(template, [filter])
template The template which describes the temporary file or directory name
to be returned. The template should resemble a valid file or
directory specification with up to 5 filter characters.
filter The filter character found in the template. Each filter character
found in the template will be replaced with a numeric value. The
resultant string represents a file or directory which does not
exist The default filter character is ?.
file A file or directory that does not currently exist. If an error
occurred or if no unique file or directory exists given the
template provided, a null string is returned.
Purpose: Returns a unique file or directory name given a certain template.
Useful when an exec requires a temporary file but doesn't want to
have to worry about overwriting an existing file.
Examples:
/* Code */
say RxTempFileName('C:\TEMP\MYEXEC.???')
say RxTempFileName('C:\TEMP\??MYEXEC.???')
say RxTempFileName('C:\MYEXEC@.@@@', '@')
/* Output */
C:\TEMP\MYEXEC.251
C:\TEMP\10MYEXEC.392
C:\MYEXEC6.019
Note:
Since it is not required that the filter characters be contiguous within the
template it is impossible to quickly determine the number of files already
residing in the target directory that would fit the template description.
RxTempFileName uses a random number algorithm to determine a number to replace
the filter characters with. It then tests if the resulting file exists. If it
does not, it increments the number, replaces the filter characters, and tests
for the existence of the new file, etc, etc. This continues until a free file
is found or all possibilities have been exhausted.
ΓòÉΓòÉΓòÉ 9.48. RxTree ΓòÉΓòÉΓòÉ
Function: RxTree
Syntax: rc = RxTree(filespec, stem, [options], [tattrib], [nattrib])
filespec The filespec to search for.
stem The name of the stem variable to place the results.
Note: stem.0 contains the number of files and/or directories
found.
options Any logical combination of the following:
F Search for files only.
D Search for directories only.
B Search for both files and directories. (default)
S Scan subdirectories recursively. (non-default).
T Return time and date fields as one easily digestible field in
the form:
YY/MM/DD/HH/MM
O Only report fully qualified file names. The default is to
report date, time, size, attributes and fully qualified file
name for each file found.
tattrib The target attribute mask used when searching for filespec
matches. Only filespecs which match the mask will be reported.
The default mask is '*****' which means the Archive, Directory,
Hidden, Read-Only, and System bits may be either set or clear.
The attributes in the mask are positional dependant and in the
alphabetical order 'ADHRS'.
Mask Options (Target Mask)
* The specified attribute may be either set or clear.
+ The specified attribute must be set.
- The specified attribute must be clear.
Examples: (Target Mask)
'***+*' Find all files which have set Read-Only bits.
'+**+*' Find all files which have set Read-Only and Archive bits.
'*++**' Find all hidden subdirectories.
'---+-' Find all files which have only the Read-Only bit set.
nattrib The new attribute mask which will be used to set the attributes of
each filespec found to match the target mask. The default mask is
'*****' which means the Archive, Directory, Hidden, Read-Only, and
System bits will not be changed. The attributes in the mask are
positional dependant and in the alphabetical order 'ADHRS'.
Mask Options (New Atrribute Mask)
* The specified attribute will not be changed.
+ The specified attribute will be set.
- The specified attribute will be cleared.
Examples: (New Attribute Mask)
'***+*' Set the Read-Only bit on all files.
'-**+*' Set the Read-Only and clear the Archive bits of each file.
'+*+++' Set all attributes on all files, excluding directory
attribute.
'-----' Clear all attribute on all files.
Note: You cannot set the directory bit on non-directory
filespecs. The attribute field which is displayed in the
stem variable is that of the current attribute setting after
any changes have been applied.
Purpose: Finds all files which are equal to the specified filespec, and
places their descriptions (date time size attr filespec) in a
stem variable.
RC: Return Codes
0 Successful.
2 Error. Not enough memory.
Examples:
/****<<< Syntax Examples >>>***********************/
/* Find all subdirectories on C: */
call RxTree 'c:\*.*', 'file', 'SD'
/* Find all Read-Only files */
call RxTree 'c:\*.*', 'file', 'S', '***+*'
/* Clear Archive and Read-Only bits for all files which have them set */
call RxTree 'c:\*.*', 'file', 'S', '+**+*', '-**-*'
/****<<< Sample Code and Output Example >>>********/
/* Code */
call RxTree 'c:\os2*.', 'file', 'B'
do i=1 to file.0
say file.i
end
/* Actual Output */
12-15-89 12:00a 4096 A-HRS C:\OS2LDR
12-15-89 12:00a 29477 A-HRS C:\OS2KRNL
5-24-89 4:59p 0 -D--- C:\OS2
ΓòÉΓòÉΓòÉ 9.49. RxUserInfo ΓòÉΓòÉΓòÉ
Function: RxUserInfo
Syntax: info = RxUserInfo()
info Userid, workstation name, and logon domain separated by spaces.
For example:
'ROY TRIGGER YKCOD02'
Purpose: This function may be used to determine the userid logged on at the
workstation; the name of the workstation; and the domain which the
user is logged onto. Each of these items of information is returned
separated by a space. If a given item is not available, then the
period character, . will be returned in its place.
Note: This function will only return valid information for OS/2 1.2
EE LAN workstations. This function loads the NetWkstaGetInfo()
function contained in NETAPL.DLL dynamically, if it is available. If
it cannot load this function, the return information string will be
'. . .'.
/* Sample Code */
parse value RxUserInfo() with userid machine domain
say 'Userid is' userid
say 'Workstation name is' machine
say 'Domain is' domain
ΓòÉΓòÉΓòÉ 9.50. RxUtilsVer ΓòÉΓòÉΓòÉ
Function: RxUtilsVer
Syntax: ver = RxUtilsVer()
ver String containing RxUtils version info in the form 'x.xx'
Purpose: Returns the version of the RXUTILS.DLL which is currently running.
ΓòÉΓòÉΓòÉ 9.51. RxWrite ΓòÉΓòÉΓòÉ
Function: RxWrite
Syntax: rc = RxWrite(filename, stem, [num], [start], [opt])
filename The name of the file to write.
stem The name of the file stem variable.
num The number of lines to write. If not specified, all lines up to
the number specified by stem.0. will be written. A number which
would cause a write past the number of lines specified in stem.0
is not permitted.
start The line number to start with. The default is 1.
opt Any logical combination of the following:
A Append the stem to the specified file. Create a new file if
the specified file does not exist. If not specified, the stem
contents will overwrite the contents of the specified file if
it already exists. This option is active only if the file
exists prior to calling RxWrite.
E Append the EOF character (0x1A) to the end of the written file.
This is not the default.
F Force the file to be written, even if the file currently exists
and its file attributes are set to READ_ONLY or SYSTEM. This
is not the default. In the default mode, RxWrite will fail if
trying to write to a file which has its READ_ONLY or SYSTEM
file attributes set. This option is active only if the file
exists prior to calling RxWrite.
R Retain previous file attributes. By default the previous file
attributes will be preserved with the addition of the setting
of the ARCHIVE bit. If the R option is specified, the previous
files attributes are retained without change. This option is
active only if the file exists prior to calling RxWrite.
T Restore the original time and date stamp of the file. This is
not the default. In the default mode, the current time and
date are used for the time and date stamp of the new file.
This option is active only if the file exists prior to calling
RxWrite.
Purpose: Writes a specified file stem variable to a specified file.
RC: Return Codes
0 Stem was written successfully.
2 Error. Not enough memory.
3 Error. Error opening file.
4 Error. Error writing file.
/* Sample Code */
call RxWrite 'c:\config.sys', 'file', file.0, , 'A'
ΓòÉΓòÉΓòÉ 10. Macrospace Functions Overview ΓòÉΓòÉΓòÉ
The following section describes the REXX interpreter macrospace and functions
for dealing with it.
The functions provided are direct interfaces into the RxMacro...() functions
provided by the REXXSAA API.
Note: The following documentation describing the REXX macrospace has been
copied from the Operating System/2 Version 1.3 Procedures Language 2/REXX
Reference guide. The author of RXUTILS is not responsible for any of its
content and as usual, the names have been changed to protect the innocent.
ΓòÉΓòÉΓòÉ 10.1. Macrospace Interface ΓòÉΓòÉΓòÉ
The macrospace interface can reduce the search time for REXX functions existing
on disk by allowing a function image to be maintained in memory for immediate
load and execution. This is especially useful for procedures and functions
which are used frequently in a program, such as editor macros and other
high-use functions.
As far as the REXX programmer is concerned, calling a macrospace-registered
function is essentially identical to calling any other function. The
macrospace functions are global to all REXX procedures. The sole difference in
execution is the priority it is given in the external-function search order.
Functions registered in the macrospace can be placed in this search order to be
executed before or after all other external functions.
The REXX interpreter environment during the execution of the macrospace
functions is essentially the same as if the functions existed in external REXX
files.
ΓòÉΓòÉΓòÉ 10.2. Search Order ΓòÉΓòÉΓòÉ
When a function is registered in the macrospace by way of the interface
functions, a flag is passed requesting the function position in the external
function search order for the REXX interpreter. There are only two valid
requests for search order positioning; before all other external functions and
after all other external functions.
ΓòÉΓòÉΓòÉ 10.3. Pre-External Function Registration ΓòÉΓòÉΓòÉ
If the function is registered with the BEFORE flag, then that function will be
located by the REXX interpreter before any functions existing in external REXX
files or in function packages. This allows the user to temporarily supersede
the normal execution of the function by replacing an external function without
deleting or renaming the file or canceling the function registration in the
packages.
ΓòÉΓòÉΓòÉ 10.4. Post-External Function Registration ΓòÉΓòÉΓòÉ
If a function is registered with the AFTER flag, then the function will be
located by the REXX interpreter after any functions existing in external REXX
files or in function packages. This allows the user to provide a default
function for use by the REXX interpreter in the event some external function
required by the interpreter cannot be found in an external REXX file or
function packages.
ΓòÉΓòÉΓòÉ 10.5. Storage of Macrospace Libraries ΓòÉΓòÉΓòÉ
Functions registered in the macrospace can be saved to a permanent storage file
on disk for loading at a later date. This allows an application, such as an
editor, to create its own library of frequently-used functions, and load the
entire macrospace library into memory for fast access by the language
processor. This macrospace library is specified by a filename. Thus, multiple
macrospace function libraries can exist concurrently on a disk.
Some consideration must be given to storage and memory utilization.
The fact that the macrospace interface is designed to enhance performance for
the external functions places severe limitations on the number of restrictions
which can be imposed by the API. Therefore, the only limitations on the number
of restrictions which will be placed on the user will be the constraints of
available memory imposed by the OS/2 program. The macrospace will be allowed
to grow so long as memory is available. However, if the macrospace grows too
large (relative to the amount of available memory), then performance of the
operating system may deteriorate due to an increased number of disk accesses to
maintain its swap file.
It is recommended then, that the macrospace not be used to hold all the
function needed by the user for a normal day of use. A more efficient method
is to maintain only those functions that are going to be used by the current
process in the macrospace, and to either delete or omit others for the
macrospace.
ΓòÉΓòÉΓòÉ 10.6. RxMacChange ΓòÉΓòÉΓòÉ
Function: RxMacChange
Syntax: result = RxMacChange(FuncName, SourceFile, Position)
FuncName The string specifying the name by which the function will be
known. This function name must be validated to follow the REXX
rules for function names; it should also correspond to function
names implemented as part of external function package.
SourceFile Is the name of the file specification of the disk file containing
the source for this function. If no file extension is supplied,
it will default to .CMD. If the full path is not specified, the
standard search will be conducted (search current directory and
OS/2 path).
Position This flag indicates where the function should be placed in the
external function search order for REXX. There are two possible
positions; a function can be placed at the beginning of the search
order (that is, before all other external functions) or at the end
of the search order (that is, after all other external functions).
The Position should be one of the following:
Position Description
BEFORE Place before external functions in search order
AFTER Place after external functions in search order
Purpose: This function can be used to add a function to the macrospace. It
may also be used to change an existing function in the macrospace.
result: Return Codes
Null String Function successfully added/changed.
ERROR:1 Out of storage space.
ERROR:7 Source not found.
ERROR:8 Invalid position.
/* Sample Code */
call RxMacChange 'COREUP', 'COREUP.CMD', 'BEFORE'
ΓòÉΓòÉΓòÉ 10.7. RxMacDrop ΓòÉΓòÉΓòÉ
Function: RxMacDrop
Syntax: result = RxMacDrop(FuncName)
FuncName The string specifying the name of the function to remove from the
macrospace.
Purpose: This function can be used to delete a function from the macrospace.
result: Return Codes
Null String Function successfully removed.
ERROR:2 Function not found in macrospace.
/* Sample Code */
call RxMacDrop 'COREUP'
ΓòÉΓòÉΓòÉ 10.8. RxMacErase ΓòÉΓòÉΓòÉ
Function: RxMacErase
Syntax: result = RxMacErase()
Purpose: This function should be called to remove all functions from the
macrospace.
There are no parameters for this function. Special care should be
taken in using this function, because no verification is done on the
deleted functions, that is, all functions are removed from the
macrospace, regardless of whether or not they are being used by other
processes.
result: Return Codes
Null String All functions successfully removed.
ERROR:2 No functions found in macrospace.
/* Sample Code */
call RxMacErase
ΓòÉΓòÉΓòÉ 10.9. RxMacLoad ΓòÉΓòÉΓòÉ
Function: RxMacLoad
Syntax: result = RxMacLoad(MacroLibFile [, Func1, Func2, ...])
MacroLibFile The name of the file specification from which to load the
macrospace. Macro library files can be created with the RxMacSave
function.
Func1, Func2, ... The names of the functions to load. If no function names
are given then all functions contained in the file will be loaded
into the macrospace.
Purpose: This function allows the user to load either all or a specified
subset of all functions from a specified file into the macrospace.
result: Return Codes
Null String Successfully loaded.
ERROR:1 Out of storage space.
ERROR:2 Function not found in macrospace.
ERROR:4 Function already exists in macrospace.
ERROR:5 Macro file error.
ERROR:6 Macro signature error.
/* Sample Code */
/* The following sample code loads the COREUP and COREFIX */
/* routines from the COREUP.MAC macro library file */
call RxMacLoad 'COREUP.MAC', 'COREUP', 'COREFIX'
ΓòÉΓòÉΓòÉ 10.10. RxMacQuery ΓòÉΓòÉΓòÉ
Function: RxMacQuery
Syntax: result = RxMacQuery(FuncName)
FuncName A string specifying the name of the function to search for in the
list of the macrospace functions.
Purpose: This function allows the user to search for a particular function in
the macrospace.
result: Return Codes
Null String Function exists.
ERROR:2 Function not found in macrospace.
/* Sample Code */
if RxMacQuery('COREUP')='' then
say 'The COREUP function EXISTS in the macrospace.'
else
say 'The COREUP function DOES NOT EXIST in the macrospace.'
ΓòÉΓòÉΓòÉ 10.11. RxMacReOrder ΓòÉΓòÉΓòÉ
Function: RxMacReOrder
Syntax: result = RxMacReOrder(FuncName, Position)
FuncName A string specifying the name of the function whose search order
positioning is to be changed.
Position This flag indicates where the function will be moved to in the
external function search order for REXX. There are two possible
positions; a function can be placed at the beginning of the search
order (that is, before all other external functions) or at the end
of the search order (that is, after all other external functions).
The Position should be one of the following:
Position Description
BEFORE Place before external functions in search order
AFTER Place after external functions in search order
Purpose: This function allows the user to change the search-order location of
a function already in the macrospace.
result: Return Codes
Null String Function search position successfully moved.
ERROR:2 Function not found in macrospace.
ERROR:8 Invalid position.
/* Sample Code */
call RxMacReOrder 'COREUP', 'AFTER'
ΓòÉΓòÉΓòÉ 10.12. RxMacSave ΓòÉΓòÉΓòÉ
Function: RxMacSave
Syntax: result = RxMacSave(MacroLibFile [, Func1, Func2, ...])
MacroLibFile The name of the file specification to which to save the
macrospace. If a file exists, it is overwritten. If a file does
not exist, it is created. The file created by the function can be
loaded with the RxMacLoad function.
Func1, Func2, ... The names of the functions in the macrospace to saved. If
no function names are given then all functions contained in the
macrospace will be saved to the file.
Purpose: This function allows the user to save either all or a specified
subset of all functions in the macrospace to a specified file.
result: Return Codes
Null String Macrospace function(s) successfully saved to macro library file.
ERROR:2 One or more of the specified functions was not found in macrospace
and therefore could not be saved.
ERROR:3 Extension required.
ERROR:5 File error.
/* Sample Code */
call RxMacSave 'COREUP.MAC', 'COREUP', 'COREFIX'
ΓòÉΓòÉΓòÉ 11. Mailslot Function Overview ΓòÉΓòÉΓòÉ
The following section describes the RxMailslot function which is a
multi-purpose function that provides a REXX interface to Mailslots.
The following information regarding OS/2 LAN Requester/Server mailslots can be
found in the LAN Server Application Programmer's Reference. Where appropriate,
DosxxxMailslot function names have been replaced with the RxMailslot function
name and the information has been slightly modified to be more applicable to
RxMailslot.
Through OS/2 LAN Requester/Server mailslots, data can be sent to either local
or remote applications on the network. The RxMailslot function creates and
deletes mailslots, retrieves information about a mailslot or a message in it,
and writes messages to mailslots.
An application creates a mailslot on a local computer by calling the RxMailslot
function with the CREATE parameter and by assigning the mailslot a name in the
format:
\mailslot\name
where:
o name is a unique set of characters distinquishing the mailslot from other
mailslots on the computer.
Mailslots come in two types:
local For example: \mailslot\name
remote For example: \\computername\mailslot\name
where:
o name is a unique set of characters distinquishing the mailslot from other
mailslots on the computer.
o computername specifies the name of a computer on the network. To send to a
particular mailslot on all computers on the network, specify * in place of
the computername.
ΓòÉΓòÉΓòÉ 11.1. RxMailslot CREATE ΓòÉΓòÉΓòÉ
Function: RxMailslot CREATE
Syntax: handle = RxMailslot('CREATE', name, messagesize, mailslotsize)
name The name of the mailslot to create. Must be of the format
\mailslot\name. Only local mailslots may be created.
messagesize Specifies the maximum message size (in bytes) that the mailslot
can accept. Generally, mailslots cannot accept messages larger
than 65475 bytes.
mailslotsize Specifies the size (in bytes) of the mailslot. mailslotsize
must equal or exceed messagesize.
Purpose: This function is used to create a specified mailslot. If
successfully created, the handle of the mailslot is returned. This
handle my be used by other RxMailslot function calls to READ or PEEK
the mailslot, QUERY information about the mailslot, or DELETE the
mailslot. You may share this handle with other REXX execs by storing
its value in an INI file via the RxOS2Ini function or via some other
data sharing technique.
handle: Handle or Return Codes
Numeric Value The handle of the successfully created mailslot.
ERROR:3 The path was not found.
ERROR:8 Sufficient memory is not available.
ERROR:87 The specified parameter is invalid.
ERROR:183 The specified mailslot already exists.
ERROR:2102 The redirector NETWKSTA.EXE has not been started.
/* Sample Code */
say 'Creating mailslot...'
handle = RxMailslot('CREATE', '\mailslot\test', 1024, 10*1024)
if abbrev(handle, 'ERROR') then do
say 'An error occurred while creating the mailslot. Program aborted.'
exit 2
end
else say 'Mailslot created successfully.'
ΓòÉΓòÉΓòÉ 11.2. RxMailslot DELETE ΓòÉΓòÉΓòÉ
Function: RxMailslot DELETE
Syntax: result = RxMailslot('DELETE', handle)
handle Handle of the local mailslot to delete.
Purpose: This function deletes a previously created mailslot. Only local
mailslots may be deleted.
result: Return Codes
Null String Mailslot deleted successfully.
ERROR:6 The specified handle is not valid.
ERROR:2102 The redirector NETWKSTA.EXE has not been started.
/* Sample Code */
call RxMailslot 'DELETE', handle
ΓòÉΓòÉΓòÉ 11.3. RxMailslot QUERY ΓòÉΓòÉΓòÉ
Function: RxMailslot QUERY
Syntax: result = RxMailslot('QUERY', handle, stem)
handle The handle of the mailslot to query information about.
stem Name of the stem variable in which to store queried information.
The queried information will be returned in the following manner:
o Message size
Returned in STEM.1 in the form: MESSAGESIZE=nnnn
o Mailslot size
Returned in STEM.2 in the form: MAILSLOTSIZE=nnnn
o Next message size
Returned in STEM.3 in the form: NEXTSIZE=nnnn
o Next message priority
Returned in STEM.4 in the form: NEXTPRIORITY=nnnn
o Number of messages
Returned in STEM.5 in the form: MSGCOUNT=nnnn
Purpose: This function returns information about a mailslot.
result: Return Codes
Numeric value Number of pending messages in the mailslot.
ERROR:6 The specified handle is not valid.
ERROR:2102 The redirector NETWKSTA.EXE has not been started.
/* Sample Code */
say 'Querying mailslot information...'
call RxMailslot 'QUERY', handle, 'stem.'
do i=1 to stem.0
say stem.i
end
/* Output */
MESSAGESIZE=1024
MAILSLOTSIZE=10240
NEXTSIZE=0
NEXTPRIORITY=0
MSGCOUNT=0
ΓòÉΓòÉΓòÉ 11.4. RxMailslot PEEK ΓòÉΓòÉΓòÉ
Function: RxMailslot PEEK
Syntax: msg = RxMailslot('PEEK', handle, [stem])
handle Handle of mailslot to peek message from.
stem Name of the stem variable in which to store additional message
information. The information will be returned in the following
manner:
o Bytes read
Returned in STEM.1 in the form: BYTESREAD=nnnn
o Next message size
Returned in STEM.2 in the form: NEXTSIZE=nnnn
o Next message priority
o Next message priority
Returned in STEM.3 in the form: NEXTPRIORITY=nnnn
Purpose: This function reads the next message from a mailslot without actually
removing the message from the mailslot.
msg: Message or Return Codes
Message The message that was successfully peeked.
ERROR:6 The specified handle is not valid.
ERROR:109 Write on pipe with no reader.
ERROR:2102 The redirector NETWKSTA.EXE has not been started.
/* Sample Code */
say 'Peeking at mailslot...'
msg = RxMailslot('PEEK', handle, 'stem.')
say 'Message='msg
do i=1 to stem.0
say stem.i
end
/* Output */
Peeking at mailslot...
Message=Hello there
BYTESREAD=11
NEXTSIZE=0
NEXTPRIORITY=0
ΓòÉΓòÉΓòÉ 11.5. RxMailslot READ ΓòÉΓòÉΓòÉ
Function: RxMailslot READ
Syntax: msg = RxMailslot('READ', handle, [stem], [timeout])
handle Handle of mailslot to read message from.
stem Name of the stem variable in which to store additional message
information. The information will be returned in the following
manner:
o Bytes read
Returned in STEM.1 in the form: BYTESREAD=nnnn
o Next message size
Returned in STEM.2 in the form: NEXTSIZE=nnnn
o Next message priority
Returned in STEM.3 in the form: NEXTPRIORITY=nnnn
timeout Timeout of the read in milliseconds. Default timeout is 1000
milliseconds (1 second). Specifying a timeout of -1 makes the read
wait until something is in the mailslot. It should be noted that
the timeout variable must be the fourth parameter to the
RxMailslot 'READ' call. This means that the stem paramater must
be specified (even if only with a null parameter) when specifying
a timeout value.
Purpose: This function reads the next message from a mailslot and removes said
message.
msg: Message or Return Codes
Message The message that was successfully read.
ERROR:6 The specified handle is not valid.
ERROR:95 Program interrupted.
ERROR:109 Write on pipe with no reader.
ERROR:2102 The redirector NETWKSTA.EXE has not been started.
/* Sample Code */
say 'Reading mailslot...'
msg = RxMailslot('READ', handle, 'stem.')
say 'Message='msg
do i=1 to stem.0
say stem.i
end
/* Output */
Peeking at mailslot...
Message=Hello there
BYTESREAD=11
NEXTSIZE=0
NEXTPRIORITY=9
ΓòÉΓòÉΓòÉ 11.6. RxMailslot WRITE ΓòÉΓòÉΓòÉ
Function: RxMailslot WRITE
Syntax: result = RxMailslot('WRITE', name, msg, priority, class, timeout)
name The name of the local or remote mailslot to write to.
msg The message to write to the mailslot. Special care should be
taken to make sure that the message is not too long for the
mailslot in which it is being sent. No error indication is given
if an attempt to write a message is unsuccessful because it is too
long. Use RxMailSlot QUERY to query information about the maximum
message size of a mailslot.
priority The priority (0 through 9) of the message. High-priority messages
are generally placed ahead of previously stored messages with
lower priority. 9 is the highest priority message level, 0 is the
lowest.
class The class of mail service to be provided:
o First-class mail (1)
The function waits until a mailslot has enough room to accept the
message or until timeout expires. First class mail can only be
delivered to remote servers or local computers.
o Second-class mail (2)
The function fails immediately if there is not enough room in the
mailslot to write the message. Second-class mail can be delivered to
remote requesters OR servers as well as to local computers.
timeout Specifies the number of milliseconds to wait when attempting to
write a message to a mailslot. If 0, the function attempts to
write the message only once. If -1, the function attempts to
write to the mailslot for an indefinite amount of time.
Purpose: This function is used to write a message to a specified local or
remote mail slot. When writing to remote mailslots, a broadcast to
all computers with said mailslot may be achieved by using a * in
place of the computername.
result: Return Codes
Null String Mailslot message written successfully.
ERROR:3 The path was not found.
ERROR:67 The network name cannot be found or attempt was made to send a
remote 1st class message.
ERROR:87 The specified parameter is invalid.
ERROR:2102 The redirector NETWKSTA.EXE has not been started.
ERROR:2351 The specified computer name is invalid.
Note: This is only a partial list. Please see DosWriteMailslot()
function definition in LAN Server Application Programmer's
Reference if needed.
/* Sample Code */
/* Broadcast a 2nd-class, high priority message */
call RxMailslot 'WRITE', '\\*\MAILSLOT\MAILQ', 'Hello', 9, 2, 0
/* Send a 1st-class message to a known computer */
call RxMailslot 'WRITE', '\\JOESCOMP\MAILSLOT\TESTSLOT', 'Test Msg', 9, 1, -1
/* Send a low-priority message to a local mailslot */
call RxMailslot 'WRITE', '\MAILSLOT\MYSLOT', 'Local Msg', 0, 1, 0
ΓòÉΓòÉΓòÉ 12. Sample REXX Exec using RxUtils ΓòÉΓòÉΓòÉ
Run the RXTEST.CMD exec for a sample usage of most RxUtils functions.
It is encouraged that programmer's look at the code of RXTEST.CMD as a sample
that uses the RXUTILS functions.
ΓòÉΓòÉΓòÉ 13. Support of RxUtils ΓòÉΓòÉΓòÉ
Support and enhancements for RxUtils will be performed by the author on an 'as
time permits' basis. Please append bug reports, requests for new features, and
general discussion of RxUtils to the RXUTILS FORUM on IBMPC.
RXUTILS PROCS also exists on IBMPC. Feel free to append any execs or
procedures that use RxUtils functions there.