REXXUTIL Information and Samples
The following attempts to better explain some of the powerful features provided by OS/2 V2's dynamic link library; REXXUTIL.DLL (Rexx utility functions). REXXUTIL functions are described in the online 'REXX Information' reference and the 'OS/2 2.0 Technical Library Procedures Language/2 REXX Reference' publication (order number S10G-6268). The information following is intended to provide a more detailed description of some of the functions.
Plans for this information
Much of this file has changed since the first few attempts at compiling useful REXXUTIL information. Plans are to place this information out on an IBM Internal FORUM, (REXXOS2 FORUM) and the OS2REXX CFORUM which makes its way out into the external customer world. Hopefully within a month or so of making it available I've received any corrections/omissions from both IBMer's and customers. Thereafter I plan to create an OS2EWS package that will contain this text information with the sample CMD files as separate files. Also I plan on including an INF formatted file of the information. I really do want the information to be as accurate as possible before creating the INF file so please report to me any items of omission or error.
Publications
One should realize that many of the functions provided by REXXUTIL have origins with Presentation Manager Winxxx calls. These publications are helpful and be reviewed for more information:
- S10G-6265 OS/2 PM Programming Reference Vol - 2
- Contains all the Winxxx calls, the Workplace Shell classes, and their _wpxxx messages. Also this is available as an online doc that comes with the OS/2 Toolkit.
- S10G-6309 OS/2 System Object Model Reference
- Also an online doc that comes with the OS/2 Toolkit.
- GBOF-2254 OS/2 Technical Redbooks (series of technical documents)
- GG24-3732 OS/2 V2 Volume 3: Presentation Manager & WPS
- GG24-3774 OS/2 V2 Volume 4: Application Development
- ZB35-5100 The REXX Language - A Practical Approach to Programming
- ISBN 0-13-780651-5
Functions
Some of the functions used/explained herein:
- SysIni
- Using REXXUTIL's SysIni function one can modify many settings of the WorkPlace Shell as well as change other applications settings that make use of *.INI files such as the system OS2.INI and OS2SYS.INI.
- SysCreateObject
- (PM WinCreateObject - Create Workplace Object):Using REXXUTIL's SysCreateObject function one can create various objects; like folders, programs, and shadow objects using Rexx. This section for the most part includes parameter information which was gathered together from various sources of information.
- SysSetObjectData
- (PM WinSetObjectData - Set Object Data):Using REXXUTIL's SysSetObjectData function one can change an objects characteristics (of an already created object, if you know its objectid).
- SysDestroyObject
- (PM WinDestroyObject - Destroy Workplace Object):Using REXXUTIL's SysDestroyObject one can delete an object created if you know its objectid.
Misc Notes
If one views the *.RC files located in your bootdrive:\OS2 directory you can learn a lot about the various INI settings and folder structure. Review INI.RC and INISYS.RC files, they are used to create your OS2.INI and OS2SYS.INI files. (Note in the *.RC files "?:" is used to indicate the boot drive)
Some of REXXUTIL's functions are only available when using the very latest REXX20 PACKAGE which consists of the very latest REXX fixes and enhancements for GA OS/2 V2.0. Should you have problems running any of the sample programs you should make sure your system has the vary latest REXX20 updates. In addition to the REXX fixes, various OS/2 V2 base fixes may be needed as well. You may need to install/apply the latest 2.0 Service Pack, or even OS/2 2.1 in order for some of the operations to behave properly.
If anyone discovers other parameters or other "hidden" features of any of the functions discussed, please share your discovery. I'll try to update the information as I receive it.
Thanks...
Michael Lamb, Workstation Technical Support, ISSC - MHV Solution Center
Appendix
This append consists of multiple pieces of information:
- Large block of text containing information that pertains to the subject. (TEXT INFORMATION)
- Sample Rexx code, some complete programs, others code fragments:
- FOLDER.CMD - Creates a folder and program objects in the folder
- SHADOW.CMD - Creates shadows of objects
- FLDSHAD.CMD - Creates a folder, then program object in the folder, then place a shadow of the program object on the desktop.
- MKSHAD.CMD - Creates a shadow object of an objectid, file or drive/directory.
- STARTDOS.CMD - Starts a DOS program using specific DOS VDM settings.
- BOOTDOS.CMD - Starts a DOS session, booting from a specific DOS image with specific DOS VDM settings.
- REBUILD.CMD - Allows one to rebuild OS/2 system objects, kinda like MAKEINI does.
- LPTADD.CMD - Code using SysIni to add LPT4-9 ports.
- OBJECTID.CMD - Code using SysIni to list OBJECTIDs known to the WorkPlace Shell
- FONTS.CMD - Code using SysIni to list installed fonts and verify their existence.
- ICONRES.CMD - Code building a folder containing many of the various icons found in installed DLL files for OS/2 V2. Demonstrates use of setup string parameter ICONRESOURCE.
- SWAPEDIT.CMD - Code that allows you to make the Enhanced Editor (EPM) the default open action for most data objects instead of the OS/2 Enhanced Editor (E).
- OPENWPS.CMD - Code that allows you to open up an objectid or directory using views you specify.
- Code Fragments
- SYSSET - Shows using SysIni to toggle various System Settings
Text Information
Function: SysCreateObject
Syntax:
result=SysCreateObject(classname, title, location <,setup>, <,duplicateflag>)
classname: The name of the class of which this object is a member.
title: The object title, as it is to appear when displayed on the user interface underneath an icon or on the title bar of an open object. (Note this can be changed later using the TITLE keyword)
location: The object location. This can be specified as either an object ID (for example, <WP_DESKTOP>) or a file system path (for example, C:\bin\mytools). (Object ids will be explained later)
setup: A WinCreateObject setup string. Described more later on.
duplicateflag: This parameter indicates what action should be taken when the Setup string specifies an object ID, and an object with that object ID already exists. If the setup string does not give an object ID, another object will be created.
result: The return code from WinCreateObject. This returns 1 (TRUE) if the object was created and 0 (FALSE) if the object was not created.
Function: SysSetObjectData
Syntax:
result=SysSetObjectData(name, setup)
name: The object name. This can be specified as an object id (for example <WP_DESKTOP>) or as a fully qualified file name.
setup: A WinCreateObject setup string. Described more later on.
result: The return code from WinSetObjectData. This will return 1 (TRUE) if the object was updated and 0 (FALSE) if the object was not updated.
Purpose: Alter the settings of an existing object.
Can be used to open an instance of an object:
/* open up the system folder */ call SysSetObjectData '<WP_OS2SYS>', 'OPEN=DEFAULT;'
Can be used to change the title of an object:
/* change Information folder name */ call SysSetObjectData '<WP_INFO>', 'TITLE=InfoFolder'
See the description of the SysCreateObject location and setup strings following for an explanation of the parameters.