Chapter 10. Classic Rexx Application Programming Interfaces

Table of Contents
Handler Characteristics
Calling the Rexx Interpreter
Subcommand Interface
External Function Interface
Registered System Exit Interface
Variable Pool Interface
Dynamically Allocating and De-allocating Memory
Queue Interface
Halt and Trace Interface
Macrospace Interface
Windows Scripting Host Interface

This appendix describes how to interface applications to Rexx or extend the Rexx language by using Rexx application programming interfaces (APIs). As used here, the term application refers to programs written in languages other than Rexx. This is usually the C language. Conventions in this appendix are based on the C language. Refer to a C programming reference manual if you need a better understanding of these conventions.

The features described here let an application extend many parts of the Rexx language or extend an application with Rexx. This includes creating handlers for subcommands, external functions, and system exits.


are commands issued from a Rexx program. A Rexx expression is evaluated and the result is passed as a command to the currently addressed subcommand handler. Subcommands are used in Rexx programs running as application macros.


are direct extensions of the Rexx language. An application can create functions that extend the native Rexx function set. Functions can be general-purpose extensions or specific to an application.

System exits

are programmer-defined variations of the operating system. The application programmer can tailor the Rexx interpreter behavior by replacing Rexx system requests.

Subcommand, function, and system exit handlers have similar coding, compilation, and packaging characteristics.

In addition, applications can manipulate the variables in Rexx programs (see Variable Pool Interface), and execute Rexx routines directly from memory (see Macrospace Interface).

Handler Characteristics

The basic requirements for subcommand, function, and system exit handlers are: