Appendix B. Sample Rexx Programs

Rexx supplies the following sample programs as .REX files.


A concurrent programming example.

This program demonstrates how to use reply to run two methods at the same time.


A complex number class.

This program demonstrates how to create a complex number class using the ::CLASS and ::METHOD directives. An example of subclassing the complex number class (the Vector subclass) is also shown. Finally, the Stringlike class demonstrates the use of a mixin to provide to the complex number class with some string behavior.


A WindowsProgramManager class example.

This sample uses the method AddDesktopIcon of the WindowsProgramManager class to create a shortcut to a program or an application on the Windows desktop.


This program demonstrates how you could use the WindowsProgramManager class to manipulate program groups and program items.


A sample use of the Sys... functions.

This program displays information about drives using the utility functions SysDriveMap, SysDriveInfo, SysFileSystemType, and SysBootDrive.


A sample use of the WindowsEventLog class.

This sample demonstrates how to read from and write to the Windows event log using the methods of the WindowsEventLog class.


A factorial program.

This program demonstrates a way to define a factorial class using the subclass method and the .methods environment symbol.


An example contrasting the GUARDED and UNGUARDED methods.

This program demonstrates the difference between GUARDED and UNGUARDED methods with respect to their use of the object variable pool.


An animal guessing game.

This sample creates a simple node class and uses it to create a logic tree. The logic tree is filled in by playing a simple guessing game.


A GUARD instruction example.

This program demonstrates the use of the START method and the GUARD instruction to control the running of several programs. In this sample, the programs are controlled by one "guarded" variable.


An example that displays the days of the month January 1994.

This version demonstrates the use of arrays to replace stems.


Starts Internet Explorer and shows the RexxLA homepage. After 10 seconds the RexxLA news page is displayed.


Shows some features of the Windows Scripting Host Shell Object:

  • Query environment string

  • List special folders

  • Create a shortcut on the desktop


Shows some features of the Windows Scripting Host Network object:

  • Query computer name, user name

  • List network connections for drives and printers


Creates a mail message in Lotus Notes® and sends it to a number of recipients automatically.


Creates a new document in WordPro 97, enters some text with different attributes, and finally saves and prints the document.


Creates a new document in WordPro 97 with a provided Smartmaster. Fills in some "Click here" fields with data prompted by the program or queried from the system. Finally the document is saved to the directory in which this Rexx program is located and is sent to the printer.


Creates a new spreadsheet in Lotus 1-2-3® and fills in a table with fictional revenue numbers. The table also contains a calculated field and different styles. A second sheet is added with a 3D chart displaying the revenue data.


Creates a Microsoft Word document, enters some text, and saves it. The program then loads the document again and modifies it.


Creates a Microsoft Excel sheet, enters some data, and saves it.


Uses the Windows Script Host FileSystemObject to obtain information about the drives of the system.


Gets the stock price from the RexxLA internet page with Microsoft Internet Explorer, and stores it in a Rexx variable.


Demonstrates the use of events with Microsoft Internet Explorer:

  • Navigate to the RexxLA homepage and disallow the changing of the URL to a page not in that "address space".


Demonstrates the use of events with Microsoft Internet Explorer:

  • Search for the string "Rexx" on the RexxLA Web page, and go randomly to one of the found sites.


This application is a "small" browser for OLE objects.


Retrieves information about a computer with ADSI.


Gets a user's full name and changes it.


Shows the use of ADSI containers.


Shows the use of filters with ADSI collections.


Displays namespaces and domains.


Enables you to inspect the properties of an object.


Creates a group, and places several users in it.


Removes the users and the group that were created in sample ADSI7.REX.


This application demonstrates the use of the GetKnownMethods method.


This is a demo application for displaying all the accounts of the windows system with WMI. It also shows how to display all the properties of a WMI object in general.


This application demonstrates how to list, start, stop, pause, or resume windows services with WMI.


This application displays by means of WMI the processes of a windows system that are running.


This sample script uses a Windows Management Instrumentation (WMI) object ("Win32_OperatingSystem") to obtain information about the installed operating system(s).


This is a demo application for inspecting some system properties using WMI.


Sample for concurrency with command line output.


A pipeline implementation.

This program demonstrates the use of the ::CLASS and ::METHOD directives to create a simple implementation of a CMS-like pipeline function.


An example that types or pushes today's date and moon phase, in English date format.


An example that lays or stacks time in English time format, and also chimes.


This program demonstrates how you could use the WindowsRegistry class to work with the Windows registry.


An Object Rexx semaphore class.

This file implements a semaphore class in Object Rexx.


A stack class.

This program demonstrates how to implement a stack class using the ::CLASS and ::METHOD directives. Also included is a short example of the use of a stack.


A simple demonstration of the complex number class.

This program demonstrates the use of the ::REQUIRES directive, using the complex number class included in the samples.


Sample uses of the pipe implementation in PIPE.REX.

This program demonstrates how you could use the pipes implemented in the pipe sample.