Using SOM Objects

In addition to creating your own classes with REXX, you can use classes, objects, and methods created with the OS/2 System Object Model, or SOM. You no longer need to work in C or C++ to use SOM objects.

To build SOM classes for use in REXX, you need to use the SOMobjects Developer Toolkit, Release 2.1 or later. The interface repository files must be available and specified correctly in the SOMIR environment variable. (See Building SOM classes for Use within REXX and the SOMObjects Developer Toolkit publications for more information.)

Because the OS/2 Workplace Shell is composed of SOM objects, you now also have complete control over the Workplace Shell from a REXX program.

Previously, traditional REXX provided some access to Workplace Shell objects from REXX utility functions (such as SysQueryClassList, SysCreateObject, SysSetObjectData and so on). Now you have access to all workplace classes and methods. The following example shows how to create a folder on the desktop by sending a wpclsNew message to the WPFolder class.

folder = .wpFolder~wpclsNew('New Folder', /* Folder will have title "New Folder" */
                          '',             /* No Specific Setup String            */
                          .wpDeskTop,     /* Create new folder on the Desktop    */
                           1)             /* Lock the object to start with       */
folder~wpOpen(0,0,0)                      /* Open the folder (Default View)      */
folder~wpClose                            /* Now close the folder.               */

This REXX information does not include documentation for the workplace classes and methods. They are documented with the reference information for the Workplace Shell in the OS/2 Technical Library. The documentation for the methods is in the form of C-language function calls. To use the function calls to REXX, do the following:

In addition to Workplace Shell objects, REXX can also create objects and run methods for classes created using SOM.


[Back: Using Devices]
[Next: Importing SOM Classes]