Sample Rexx Programs

Rexx supplies the following sample programs as &per;cmd , .cls (a package meant to be used via the ::REQUIRES directive) and .frm (a package meant to be used via the ::REQUIRES directive) files.

Platform independent samples
arithmeticEvaluation&per;cmd This program demonstrates a number of principles of object-oriented programming.This implements a simple expression evaluator that builds a parse tree for an arithmetic expression that can also evaluate the This program demonstrates how to given expression. use reply to run two methods at the same time.
arrayCallback&per;cmd This program demonstrates how routines can be used to perform a function over all elements in an array.
ccreply&per;cmd A concurrent programming example.This program demonstrates how to use reply to run two methods at the same time.
complex.cls 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.
concurrency&per;cmd This is a simple demonstration of multi-threaded execution with some syncronization between the threads.
constrained&per;cmd Demonstrate how to use the isA method to check for particular types of objects.
delegation&per;cmd Demonstrate the concept of a object method delegation, where one object can pass on a method to another object
drives&per;cmd A sample use of the Sys... functions.This program displays information about drives using the utility functions SysDriveMap, SysDriveInfo, SysFileSystemType, and SysBootDrive.
dynamicMethod&per;cmd This program demonstrates how methods can be dynamically added to an object instance.
factorial&per;cmd A sample that demonstrates a factorial method routine.This sample defines a floating method (one that is not assigned to a class) that implements a factorial algorithm. Using the.methodsenvironment symbol this method gets fetched and added under the name factorial to the class named factorial_class, created as a subclass of the String class.
greply&per;cmd 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.
guess&per;cmd 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.
interface&per;cmd This program demonstrates to define an interface class in ooRexx. object instance.
ktguard&per;cmd 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.
makestring&per;cmd A sample to demonstrate a combination of makearray method of the stream and makestring method of the array class. The sample creates a temporary file with text, reads in all data using the makearray method of the stream class, removes all comments of the file and writes back data to a temporary file using the makestring method of the array class. After displaying the content of the input and output file, the temporary files are removed from the system.
month&per;cmd An example that displays the days of the monthJanuary 1994.This version demonstrates the use of arrays to replace stems.
philfork&per;cmd Philosophers' Forks: Console window version. Sample for concurrency with command line output.
pipe.cls 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.
properties&per;cmd This program demonstrates the Properties class.
qdate&per;cmd An example that types or pushes today's date and moon phase, in English date format.
qtime&per;cmd An example that lays or stacks time in English time format, and also chimes.
rexxcps&per;cmd Measuring REXX clauses/second.
scclient&per;cmd Simple socket client using socket class (package socket.cls).
scserver&per;cmd Simple socket server using socket class (package socket.cls).
semcls.cls This Rexx package demonstrates how to implement public semaphore classes (EventSemaphore, MutexSemaphore) in Object Rexx.
sfclient&per;cmd Simple socket client using socket function package.
sfserver&per;cmd Simple socket server using socket function package.
singleLinkedList&per;cmd A simple implementation of a linked list using objects.
singleton.cls A metaclass (a subclass of Class) named Singleton that makes sure that only one (a single) instance gets created for a class that employs this metaclass.
sortComposite&per;cmd Demonstrates on how to sort non-string objects using the built in sort methods.
stack&per;cmd 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.
synchronousConcurrency&per;cmd This uses a work queue to synchronize activity between two independent threads
timezone&per;cmd Sample of performing timezone manipulations. Also shows a handy technique for embedding data in program.
treeDirectory.cls A directory implementation using a balanced binary tree. Unlike the directory class, indexes are maintained in sorted order.
treeTraversal&per;cmd Build a binary tree structure and demonstrate different traversal methods (preorder, inorder, postorder and levelorder traversals).
usecomp&per;cmd A simple demonstration of the complex number class.This program demonstrates the use of the ::REQUIRES directive, using the complex number class implemented in the package complex.cls .
usepipe&per;cmd Sample uses of the pipe implementation in package pipe.cls .This program demonstrates how you could use the pipes implemented in the package pipe.cls.
usesingleton&per;cmd Sample use of the metaclass named Singleton defined in package singleton.cls , which makes sure that only one (a single) instance of the singletonExample class can be created.
usetree&per;cmd Sample uses of the pipe implementation in package treeDirectory.cls.This program demonstrates how you could use the treeDirectory class implemented in the package treeDirectory.cls.
Windows only samples
ole\\apps\\MSAccessDemo&per;cmd Demonstrate how one can interact withJet (MS Access) databases usingActiveX/OLE.
ole\\apps\\oleUtils.frm Provides some useful utilities for working with the OLEObject class.
ole\\apps\\samp01&per;cmd StartsInternet Explorerand shows theIBMhomepage. After 10 seconds theIBMnews page is displayed.
ole\\apps\\samp02&per;cmd Shows some features of theWindows Scripting Host Shellobject:
  • Query environment string
  • List special folders
  • Create a shortcut on the desktop
ole\\apps\\samp03&per;cmd Shows some features of theWindows Scripting Host Network object:
  • Query computer name, user name
  • List network connections for drives and printers
ole\\apps\\samp04&per;cmd Creates a mail message in Lotus Notes and sends it to a number of recipients automatically.
ole\\apps\\samp05&per;cmd Creates a new document inLotus WordPro 97, enters some text with different attributes, and finally saves and prints the document.
ole\\apps\\samp06&per;cmd Creates a new document inLotus WordPro 97with a providedSmartmaster. 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.
ole\\apps\\samp07&per;cmd 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.
ole\\apps\\samp08&per;cmd Creates aMicrosoft Worddocument, enters some text, and saves it. The program then loads the document again and modifies it.
ole\\apps\\samp09&per;cmd Creates aMicrosoft Excelsheet, enters some data, and saves it.
ole\\apps\\samp10&per;cmd Uses theWindows Script Host FileSystemObjectto obtain information about the drives of the system.
ole\\apps\\samp11&per;cmd Gets the stock price from the RexxLA internet page with Microsoft Internet Explorer, and stores it in a Rexx variable.
ole\\apps\\samp12&per;cmd 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".
ole\\apps\\samp13&per;cmd 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.
ole\\oleinfo\\oleinfo&per;cmd This application is a "small" browser for OLE objects.
ole\\adsi\\adsi1&per;cmd Retrieves information about a computer withADSI.
ole\\adsi\\adsi2&per;cmd Gets a user's full name and changes it.
ole\\adsi\\adsi3&per;cmd Shows the use ofADSIcontainers.
ole\\adsi\\adsi4&per;cmd Shows the use of filters withADSIcollections.
ole\\adsi\\adsi5&per;cmd Displays namespaces and domains.
ole\\adsi\\adsi6&per;cmd Enables you to inspect the properties of an object.
ole\\adsi\\adsi7&per;cmd Creates a group, and places several users in it.
ole\\adsi\\adsi8&per;cmd Removes the users and the group that were created in sample adsi7.rex.
ole\\methinfo\\main&per;cmd This application demonstrates the use of the GetKnownMethods method.
ole\\wmi\\accounts&per;cmd This is a demo application for displaying all the accounts of the windows system withWMI. It also shows how to display all the properties of aWMI object in general.
ole\\wmi\\services&per;cmd This application demonstrates how to list, start, stop, pause, or resume windows services withWMI.
ole\\wmi\\process&per;cmd This application displays by means ofWMIthe processes of a windows system that are running.
ole\\wmi\\osinfo&per;cmd This sample script uses aWindows Management Instrumentation (WMI) object ("Win32_OperatingSystem") to obtain information about the installed operating system(s).
ole\\wmi\\sysinfo\\sysinfo&per;cmd This is a demo application for inspecting some system properties using WMI.
oodialog\\winsystem\\deskicon&per;cmd A WindowsProgramManager class example.This sample uses the method addDesktopIcon of theWindowsProgramManager class to create a shortcut to a program or an application on the Windows desktop.
oodialog\\winsystem\\desktop&per;cmd This program demonstrates how you could use the WindowsProgramManager class to manipulate program groups and program items.
oodialog\\winsystem\\displayAnyMenu&per;cmd Displays the menu hierarchy for a window that the user picks.It uses the functionality of the windowsSystem.frm Rexx package which makes it easy to use the most important functionality of the winsystm.cls and ooDialog.cls Rexx packages. In addition it demonstrates the usage of winSystemDlgs.h and winSystemDlgs.rc files that define Windows graphical user interfaces (GUI).
oodialog\\winsystem\\displayWindowTree&per;cmd Displays the window hierarchy for a top level window that the user picks.It uses the functionality of the windowsSystem.frm Rexx package which makes it easy to use the most important functionality of the winsystm.cls and ooDialog.cls Rexx packages. In addition it demonstrates the usage of winSystemDlgs.h and winSystemDlgs.rc files that define Windows graphical user interfaces (GUI).
oodialog\\winsystem\\eventlog&per;cmd 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.
oodialog\\winsystem\\getTheWindow&per;cmd This example shows how to find a window without using the exact window title.Displays the window containing part of the user supplied window title irrespective of case. It uses the functionality of the winsystm.cls Rexx package.
oodialog\\winsystem\\menuNotepad&per;cmd This example displays the hierarchy of the Notepad menu.It uses the functionality of the windowsSystem.frm Rexx package which makes it easy to use the most important functionality of the winsystm.cls and ooDialog.cls Rexx packages.
oodialog\\winsystem\\quickShowAllMenus&per;cmd This program prints out a menu outline of every open window that has a menu.It uses the functionality of the windowsSystem.frm Rexx package which makes it easy to use the most important functionality of the winsystm.cls and ooDialog.cls Rexx packages.
oodialog\\winsystem\\registry&per;cmd This program demonstrates how you could use the WindowsRegistry class to work with the Windows registry.
oodialog\\winsystem\\windowsSystem.frm A Rexx package (a collection of public routines and classes) to help work with the winsystm.cls package. It demonstrates the usage of winSystemDlgs.h and winSystemDlgs.rc files that define Windows graphical user interfaces (GUI).