Fact-checked by Grok 2 weeks ago

Rexx

REXX (Restructured Extended Executor) is a versatile, language designed for ease of use in scripting, programming, prototyping, and general application development, featuring human-like syntax, string-based handling, and high portability across systems. Developed by Mike Cowlishaw at Laboratories in Hursley and the between 1979 and 1982, REXX was first implemented under the Conversational Monitor System () in IBM's /System Product (VM/SP) Release 3 in 1983, evolving through extensive user feedback via the VNET network connecting over 1,400 mainframes. Its design prioritizes readability with free-format syntax, minimal punctuation, English-like keywords (e.g., IF-THEN-ELSE, DO-END loops), and no variable declarations or strong typing—all treated as strings for natural manipulation. Key features include , robust string processing, dynamic scoping, built-in debugging and tracing, and the ability to issue system commands or interlanguage calls while remaining largely system-independent, making it suitable for applications ranging from short scripts to programs exceeding one million lines. In environments like , REXX serves as an interpreted (or optionally compiled) language for TSO/E commands, ISPF dialogs, system automation, and , often compared to the simplicity of for job control. Standardized by the (ANSI) as X3.274-1996 (later INCITS 274-1996 with reaffirmations), the language ensures consistent interpretation across compliant implementations, promoting portability and reliability. Variants like NetRexx extend its capabilities for integration, enhancing performance and security in modern contexts. Widely adopted in ecosystems for over four decades, REXX remains influential for its balance of simplicity and power, influencing scripting languages and continuing use in .

Introduction

Name and Origin

REXX, originally conceived as REX (Reformed Executor), emerged as a programming language designed to enhance ease of use in scripting tasks. The name REX was first noted on March 20, 1979, with the initial specification dated March 29, 1979, reflecting its intent as a reformed approach to command execution. By 1982, it was renamed Rexx with an additional "x" to distinguish it from existing products and avoid potential naming conflicts. Upon its first release in 1983 as part of IBM's VM/SP Release 3, the name was expanded to REstructured eXtended eXecutor, underscoring its restructured syntax and extended capabilities for execution in diverse environments. The language was developed by Mike F. Cowlishaw, an engineer, primarily at the IBM United Kingdom Laboratories Limited in Hursley, , with contributions during 1979–1982 also involving the in . Cowlishaw initiated the project as a personal endeavor to address the limitations of existing scripting tools under the VM/CMS operating system, prioritizing human readability and simplicity over computational efficiency. This focus stemmed from observations of the cumbersome nature of prior languages, aiming to create a tool that felt more natural for non-expert users. REXX's foundational purpose was to serve as a portable, English-like replacement for the EXEC and CLIST scripting languages used by VM/ operators, facilitating system administration, , and macro programming. By emphasizing straightforward syntax and portability across systems, it sought to reduce errors and accelerate development for tasks like command automation and personal computing utilities, marking a shift toward user-centric design in procedural languages.

Key Attributes

Rexx features a , English-like syntax designed for and ease of use, consisting of only 23 basic instructions with no globally reserved keywords, which enables free-form coding without rigid formatting requirements. This approach allows developers to write code in a natural style, mixing upper and lower case letters and using optional , making it accessible even to those unfamiliar with programming conventions. The language employs dynamic typing with typeless variables that do not require declaration and treat all data as , automatically converting types as needed during operations. Arithmetic operations support arbitrary-precision decimal calculations, defaulting to nine significant digits but configurable via the NUMERIC instruction to handle up to thousands of digits for precise computations. Rexx includes over 60 built-in functions for tasks such as mathematical operations, manipulation, and environment queries, enhancing its utility for everyday scripting needs. Portability is achieved through abstraction of the host environment, allowing Rexx programs to interact with various operating systems and applications via the ADDRESS instruction without direct platform-specific code. These attributes stem from Rexx's origins at , where it was engineered for versatility across mainframe systems. Key strengths include its human-readable nature, which suits non-programmers for tasks like writing macros, , and educational purposes, while limitations encompass the absence of native support for include files—requiring workarounds like subroutine calls—and incomplete integration with Unix-style pipes in non-specialized environments, often necessitating external tools or extensions. In terms of popularity, Rexx maintains a low profile in general metrics, with ratings historically below 0.1% as of 2018 and remaining outside the top 50 languages in subsequent years, reflecting its niche endurance in mainframe and legacy systems. Despite this, recent developments indicate renewed interest in Rexx for modern scripting, highlighted by open-source advancements and articles promoting its revival for cross-platform use in 2022.

History

Early Development (1979–1989)

The development of Rexx originated in 1979 when Mike Cowlishaw, working at 's Laboratories in , began prototyping a initially named to simplify command and programming within IBM's mainframe environments. The first specification was documented on March 29, 1979, and an initial implementation was completed later that year, allowing for internal testing and feedback through IBM's VNET network, which connected over 1,400 mainframes across 40 countries. By 1980, a more stable version (2.00) was in use internally at IBM for prototyping, , and personal programming tasks, emphasizing readability and ease of use over complex syntax. The language stabilized in 1982, with the name adjusted to REXX by adding an "X" to distinguish it from other tools, and it was formally named as such in 1984. Its first production release came with VM/SP Release 3 in 1983, integrated as the System Product Interpreter for the Conversational Monitor System () under VM/CMS, marking Rexx's debut as a for dialog and command scripting in virtual machine environments. Prior to any public standard, Rexx remained to , with early adoption focused on system administration tasks, where it began replacing older procedural languages like EXEC by offering more natural syntax for scripting host commands and automating routines. Initial external awareness emerged through IBM's technical documentation and reference manuals, such as the Virtual Machine/System Product: System Product Interpreter Reference, which highlighted its role in enhancing productivity for users. Expansion accelerated in the mid-to-late 1980s as Rexx was ported to additional platforms. In 1988, it was introduced to /TSO environments as part of TSO Extensions (TSO/E) Version 2, enabling REXX execs for batch and interactive processing on systems. By 1987, designated Rexx as the standard procedures language within its Systems Application Architecture (SAA), promoting portability across systems like VM, , and OS/400, with implementations following for in Extended Edition 1.2 (1989) and RS/6000 running AIX (also 1989). This integration solidified Rexx's proprietary status while fostering its use in cross-platform scripting, though it remained without a public standard until later efforts.

Standardization and Growth (1990–2010)

The first Rexx Symposium for Developers and Users, held on June 11, 1990, at the Stanford Linear Accelerator Center (SLAC), marked a pivotal moment in the language's evolution beyond IBM's proprietary ecosystems. Organized by Cathie Dager of SLAC, the event brought together developers and users to discuss Rexx's potential for broader adoption, fostering enthusiasm that led to the formation of the Rexx Language Association (RexxLA) in 1991. This highlighted the need for to ensure portability across diverse platforms, setting the stage for international collaboration. In response to growing demand for interoperability, the (ANSI) published the X3.274-1996 standard, titled "Information Technology - Programming Language REXX," which defined the core syntax, semantics, and constraints of the language to facilitate portability. This standard, reaffirmed in with supplements addressing errata, emphasized Rexx's arithmetic capabilities and ensured compatibility without introducing major syntax alterations from prior implementations. Influenced by similar efforts in language , such as ISO/IEC 13211:1994 for , the ANSI standard promoted Rexx's use in multi-vendor environments by focusing on compliance rather than radical changes. Early implementations served as the foundational reference for this , providing a stable baseline for the core language features. The 1990s saw significant growth through open-source implementations that extended Rexx to non-IBM platforms. , an interpreter for Unix systems written in using lex and , was announced in May by Anders Christensen, enabling Rexx scripting on , , and other Unix variants with full compliance to the emerging standards. Similarly, REXX/imc, developed by Ian Collier in for and later ported to other Unix systems, provided another open-source option that supported Rexx's procedural capabilities in academic and settings. These efforts democratized access to Rexx, allowing its use in utilities, , and system administration without reliance on proprietary hardware. IBM contributed to this expansion with Object REXX (ooRexx), an object-oriented extension that maintained upward compatibility with classic Rexx while adding classes, inheritance, and integration with the System Object Model (SOM). A was demonstrated at the 1992 Rexx Symposium, with the first official release in 1996 as part of 4, initially targeting but soon ported to Windows and AIX. This version enhanced Rexx's applicability in graphical user interfaces and enterprise applications, aligning with 's Systems Application Architecture (SAA) push to extend Rexx as a standard procedure language to non- platforms like AS/400 and VSE. The RexxUtil toolkit, introduced during this period for and Windows, provided essential extensions such as file I/O, manipulation, and handling, further bolstering practical deployment without altering the core syntax. Rexx's footprint widened through ports to additional environments, including expansions of ARexx for the platform, which was integrated into 2.0 in 1990 and further developed with 3.0 in 1992 to support inter-application scripting via ports. Implementations for Windows and proliferated in the late , often leveraging Regina or ooRexx, positioning Rexx as a versatile scripting tool akin to early influences on languages like Tcl for and . By the , Rexx had matured into a compliant, portable language used in for teaching and in utilities for cross-platform task . The 2004 International Rexx Symposium in celebrated the language's 25th anniversary, underscoring its enduring relevance and community-driven growth.

Modern Era and Recent Developments (2011–present)

In 2019, the Rexx Language Association (RexxLA) hosted its 30th annual symposium in Hursley, , commemorating the 40th anniversary of Rexx's initial development at . The event featured presentations on classic Rexx, NetRexx, and Open Object Rexx (ooRexx), underscoring the language's enduring legacy in scripting and . Rexx maintains significant relevance in modern computing, particularly for scripting on IBM mainframes and general-purpose tasks. IBM's TSO/E REXX Reference documentation, updated through 2021, details its integration for executing programs in TSO/E environments, including access to z/OS UNIX System Services for hybrid workflows. Similarly, the Using REXX and z/OS UNIX System Services guide highlights its role in invoking callable services, enabling seamless interaction between mainframe and systems. Articles on Opensource.com in promoted Rexx as a versatile for contemporary open-source environments, emphasizing its simplicity for tasks like text processing and system administration. Recent implementations have seen active maintenance and enhancements. The Regina Rexx interpreter, hosted on SourceForge, continues ongoing updates, with file modifications as recent as March 2025, ensuring ANSI compliance and portability across Unix-like platforms, Windows, and OS/2. ooRexx, the open-source object-oriented extension, released version 5.0.0 in December 2022, introducing features like annotations for classes, methods, and attributes, along with the new RexxInfo class to bolster object-oriented programming capabilities. Version 5.1.0 reached general availability in 2025, with further improvements in performance, command redirection, bug fixes, and feature enhancements for integrated scripting. In 2025, the Open Mainframe Project's Winter Mentorship program advanced Rexx's tooling by developing a (LSP) extension for using the Langium framework, enhancing IDE support for syntax highlighting, autocompletion, and diagnostics in mainframe development. RexxLA sustains community engagement through annual symposia, such as the 35th International Rexx Language Symposium in March 2024 in , , which included hybrid online participation to discuss portability in cloud-mainframe environments. The 36th symposium, held in May 2025 in , , featured updates including the ooRexx 5.1.0 release and ongoing adaptations for hybrid environments. While no major updates to the ANSI Rexx standard have occurred since 1996, efforts emphasize Rexx's adaptability for hybrid cloud integrations, leveraging its cross-platform interpreters to bridge legacy mainframe applications with modern distributed systems.

Implementations

Host Environments

REXX is an interpreted that is typically within host operating systems and applications, allowing it to execute in environments such as IBM z/OS via TSO/E, z/VM through , and various implementations on Windows, Unix, and systems using dedicated interpreters. In these hosts, REXX programs, known as execs, interact with the underlying system without making direct operating system calls, promoting portability across diverse platforms. A key mechanism for this portability is the abstract interface provided by host command environments, which insulate REXX from platform-specific details. The ADDRESS instruction routes commands to these environments, such as ADDRESS SYSTEM to invoke commands like listing files, enabling REXX to issue system-level operations indirectly through the host's defined processors. For instance, in TSO/E, REXX execs can run interactively or as batch jobs using utilities like IKJEFT01, facilitating automated processing of mainframe tasks without direct interactions. Similarly, in the operating system, ARexx integrates with applications via message ports, allowing scripts to control programs like text editors or databases through host addresses. In CICS environments, REXX serves as a for , where execs can be invoked via transactions to manage resources like temporary storage queues or automate workflows. The evolution of REXX host interactions began with IBM's Systems Application Architecture (SAA) initiative in , which standardized REXX as a common procedures language across platforms like , VM, and , defining consistent host command environments to enhance interoperability. In modern contexts, REXX continues to adapt through integrations like Eclipse-based editors in Developer for , which provide and for mainframe scripts, and containerized emulations using with tools like to simulate environments on commodity hardware. These advancements maintain REXX's role in hybrid cloud and pipelines while preserving its core portability principles.

Major Implementations and Toolkits

Rexx implementations vary across platforms, with a focus on maintaining compatibility with the ANSI X3.274-1996 standard while adding platform-specific extensions. The original implementation, known as RXAPI or System Rexx, remains the reference for mainframe environments, supporting , , and VSE systems through integrated for OS interaction and command stacking. This version includes ongoing updates bundled with operating systems, ensuring and support for enterprise scripting tasks like database access via DB2. Open-source alternatives emphasize portability. , an ANSI-compliant interpreter, runs on Unix-like systems (, macOS, BSD), Windows, and , with features like , , and extensions for stream I/O and bit operations. Its latest release, version 3.9.7, continues active maintenance for cross-platform scripting. Similarly, BRexx provides a lightweight, high-performance option for , Windows, , and emulated mainframes, incorporating dynamic linking and database functions while adhering to TRL-2 standards. Object-oriented extensions build on classic Rexx syntax. ooRexx, originally developed by with contributions from and others in the early 1990s, introduces classes, methods, and GUI support via ooDialog, remaining fully backward-compatible with ANSI Rexx. The open-source project, managed by the Rexx Language Association, released version 5.1.0 in May 2025, adding enhancements like improved concurrency and handling across Windows, , and . NetRexx, a 1996 variant with Java-like syntax, compiles to JVM bytecode for seamless integration with libraries, supporting web servlets and enterprise applications; its current version 5.01-GA (as of May 2025) is maintained openly for cross-platform use. Platform-specific ports include ARexx for and emulators like AROS and , where it serves as the default tool since 1988, with ANSI compliance and ongoing use in legacy environments. REXX for PHP embeds Rexx commands into PHP scripts for , allowing native Rexx functions in includable PHP files. Toolkits extend Rexx's capabilities without altering core syntax. RexxUtil provides cross-platform utilities for file I/O, dialogs, and system calls on Windows, VM, and Unix. Rexx/Tk enables GUI development using Tcl/Tk, supporting widgets and event handling on major platforms under GNU LGPL. Rexx/SQL facilitates database connectivity via ODBC and CLI standards, compatible with interpreters like Regina and ooRexx. The Rexx Language Support extension for provides LSP-based features like and autocompletion for editing Rexx code (as of August 2025). All major implementations target ANSI X3.274 compliance, with extensions like NetRexx diverging for specialized environments.

Syntax and Language Features

Instruction Types and Basic Syntax

REXX features a free-form syntax that provides programmers with considerable flexibility in code layout. There are no restrictions on where an may start within a line, and code can span multiple lines without mandatory indentation. Clauses—the fundamental units of executable code—are delimited by semicolons or by the end of a line, allowing multiple clauses to appear on a single line when separated by semicolons. The language treats keywords and symbols in a case-insensitive manner, while preserving the case of string literals. Comments in REXX are enclosed within /* and */ delimiters, which can encompass multiple lines and are entirely ignored during execution. These comments support nesting, with implementations required to handle at least ten levels. and are commonly used at the start of programs to describe their purpose. REXX instructions fall into three main categories: assignments, keyword instructions, and commands. Assignments bind the result of an expression to one or more symbols using the equals sign (=), as in total = 0 or, with templates for pattern matching, first second = "apple banana cherry", which assigns "apple" to first and "banana" to second while leaving "cherry" unassigned. Keyword instructions invoke built-in language functions, such as SAY, which directs the evaluated expression to the standard output stream: SAY "Hello, World!" produces the literal output "Hello, World!". Commands facilitate interaction with the host system and are prefixed by the ADDRESS instruction, which specifies the target environment (e.g., SYSTEM or TSO) followed by the command string, like ADDRESS SYSTEM "ls". Expressions within instructions are evaluated from left to right, subject to operator precedence that prioritizes operations such as over . Parentheses can alter this order explicitly. The PARSE ARG instruction processes program arguments using a to distribute values into variables, for example, PARSE ARG user input assigns the first argument to user and the second to input. Programs typically conclude with the EXIT instruction, which halts execution and optionally sets a return value via an expression, such as EXIT 0 to indicate successful completion. The following example illustrates a basic REXX program structure incorporating these elements:
/* Greeting program that processes an argument */
PARSE ARG name
IF name = "" THEN name = "World"
SAY "Hello," name "!"
EXIT 0
This code parses an input argument into name, defaults it if absent, outputs a greeting, and exits cleanly.

Control Structures

Rexx provides structured control mechanisms for managing program flow, including iterative loops via DO groups, conditional execution with IF statements, and multi-way branching through SELECT constructs. These features enable programmers to implement repetitive tasks, logic, and switch-like behavior in a readable and flexible manner, drawing from the language's design emphasis on simplicity and clarity. The primary looping construct in Rexx is the DO group, which encloses a block of instructions between DO and END keywords, allowing for single execution or repetition based on specified criteria. Simple DO groups execute their instructions once without iteration, serving to group multiple statements, as in DO; say 'Grouped'; say 'statements'; END;. For repetitive execution, a DO group can specify an iteration count, such as DO 5; say i; END;, which repeats the block five times while implicitly setting a counter variable i from 1 to 5. Controlled iteration uses the form DO name=initial TO final [BY increment]; ... END;, where the loop variable name advances from initial to final in steps of increment (defaulting to 1), for example, DO i=1 TO 10 BY 2; say i; END;, outputting odd numbers from 1 to 9. Conditional variants include DO WHILE condition; ... END;, which tests the condition before each iteration and continues only if true, and DO UNTIL condition; ... END;, which tests after each iteration and stops when true; both can combine with iteration specs, like DO i=1 TO 10 WHILE i<6; say i; END;. Infinite loops use DO FOREVER; ... END;, requiring explicit termination via other controls. These DO types support nesting and can mix iteration and conditions for complex loops, with the control variable's final value retained after execution. Conditional execution relies on the IF statement, structured as IF condition THEN instruction [ELSE instruction];, where the THEN clause executes if the condition evaluates to true (non-zero and non-null in Rexx's logical sense), and the optional ELSE provides an alternative for false conditions. For multi-statement blocks, IF uses a DO group: IF condition THEN DO; instructions; END; [ELSE DO; instructions; END;]. This supports multi-way decisions through nested IFs or chained ELSE clauses, though deeply nested forms can reduce readability. For instance, IF x > 0 THEN SAY 'Positive' ELSE SAY 'Non-positive'; demonstrates basic usage, while IF answer='YES' THEN DO; say 'OK!'; ELSE say 'Why not?'; END; handles grouped actions. ELSE clauses pair with the nearest unmatched IF, ensuring unambiguous scoping in nests. For switch-like multi-way branching, Rexx employs the SELECT construct: SELECT; WHEN condition THEN instruction; [WHEN condition THEN instruction; ...] [OTHERWISE instruction;] END;, which evaluates WHEN conditions in order and executes the first true one's THEN clause, falling to OTHERWISE if none match. Multi-statement WHEN or OTHERWISE blocks require DO-END, as in:
SELECT;
  WHEN x=1 THEN DO; say 'One'; END;
  WHEN x=2 THEN say 'Two';
  OTHERWISE say 'Other';
END;
This structure promotes efficient handling of multiple discrete cases, with OTHERWISE being optional but recommended for completeness. Conditions in IF, SELECT, and DO loops involve Rexx's expression evaluation, where logical truth is any non-zero numeric or non-null string value. Within DO loops, flow can be altered using LEAVE and ITERATE. LEAVE [loopname]; immediately exits the innermost (or named) DO group, useful for early termination, such as in DO i=1 TO 10; if i=5 THEN LEAVE; say i; END;, which outputs 1 through 4. Conversely, ITERATE [loopname]; skips remaining instructions in the current iteration and advances to the next, for example, DO i=1 TO 4; if i=2 THEN ITERATE; say i; END;, outputting 1, 3, and 4. Rexx lacks a direct break equivalent outside loops but uses SIGNAL for broader exits, though LEAVE and ITERATE suffice for most iterative control without overlapping variable scoping issues, as loop variables are local to their DO group unless explicitly declared otherwise.

Variables and Data Handling

In REXX, variables are typeless and require no explicit declaration; they are created implicitly upon the first assignment using the equals (=). For instance, the statement x = 5 creates the variable x and assigns it the 5, which can be a , number, or expression result. Variable names, known as symbols, consist of letters (A-Z, a-z), digits (0-9), and periods (.), starting with a letter or period, and are case-insensitive by default, though implementations may vary in preserving case. When a is referenced before assignment, its behavior depends on the and implementation settings. In contexts, an unassigned substitutes its own name in uppercase letters (e.g., referencing foo outputs "FOO"), unless the variable has been explicitly dropped, in which case it may raise the NOVALUE condition. In numeric contexts, referencing an unassigned variable raises the NOVALUE condition unless trapped with SIGNAL ON NOVALUE, allowing programmers to handle such cases gracefully without strong typing enforcement. This design promotes flexibility while encouraging explicit error handling for uninitialized data. REXX employs a dynamic typing system with no distinction between integers, floats, or other numeric types; all variables store internally, and occurs automatically based on usage. For example, assigning y = "123" treats y as the "123", but using it in a numeric operation like z = y + 1 converts it to the number 123, resulting in z = 124. The DATATYPE built-in function can inspect a variable's effective type (e.g., NUM for numeric, CHAR for character ), but no compile-time or runtime type checking enforces fixed types, reducing errors from type mismatches. Expressions involving variables are evaluated from left to right, respecting operator precedence (e.g., ** before * and /, which precede + and -), with parentheses overriding the order. Numbers in expressions are interpreted as unless specified otherwise (e.g., 3.14 or 1E3 for ), while non-numeric strings remain as-is. Lazy evaluation is not strictly defined, but variable substitution occurs just before operations, allowing indirect references without immediate resolution. For example:
total = price * (1 + tax_rate)
Here, if price is "10.00" and tax_rate is 0.08, total becomes 10.80 after implicit conversions. Compound variables extend scalar handling by using a (a followed by a period, e.g., arr.) combined with a (a derived or expression, e.g., arr.1), forming dynamic structures like arrays or associative storage without predefined sizes. creates elements , such as arr.1 = "value", and the special .0 often tracks the number of elements (e.g., arr.0 = 3). Tails support indirect referencing via tail notation, where the tail is another variable or expression (e.g., i = 2; word.i = "hello" sets word.2 to "hello"). This enables flexible data structures, like:
do i = 1 to 3
  data.i = i * 10
end
resulting in data.1 = 10, data.2 = 20, and data.3 = 30, with automatic indexing. Special variables provide access to runtime state without explicit assignment. The RC variable holds the return code from the previous external command, function call, or address space invocation (e.g., after ADDRESS TSO "LISTDS", RC might be 0 for success). The single dot (.) represents the current index in loops or the result of the last evaluated expression in certain contexts. These, along with symbols like SIGL (signal label) and RESULT (routine return value), are predefined in the variable and cannot be freely reassigned in standard implementations. Tail notation in often interacts with these for dynamic access, such as word.RC to index by return code . The NOVALUE condition further safeguards against unintended references to unset special or compound elements.

String Processing and Evaluation

Rexx provides robust facilities for string manipulation and dynamic evaluation, primarily through the PARSE instruction and the INTERPRET instruction, enabling efficient scripting for data extraction and code generation. These tools allow developers to split input strings into variables using customizable templates and to execute strings as Rexx code at runtime, making Rexx particularly suited for processing command-line arguments, user input, and generated scripts. The PARSE instruction assigns data from various sources to one or more variables according to specified parsing rules. Its general syntax is PARSE [UPPER] [source] [WITH] template_list, where the optional UPPER clause converts the source string to uppercase before parsing, and the source can be one of several variants: for program arguments, EXTERNAL for terminal input, NUMERIC for settings like DIGITS and FUZZ, PULL for data queue or input stream, SOURCE for program invocation details, VALUE followed by an expression, VAR followed by a variable name, or VERSION for language level information. For instance, PARSE [ARG](/page/ARG) args extracts command-line arguments into variables, while PARSE PULL line reads the next line from input and parses it. Templates consist of symbols or patterns separated by blanks, with multiple templates separated by commas; if no template is provided, the source string is prepared but not assigned. Parsing operates positionally on the source string, assigning substrings to variables based on template elements. Basic templates split by default on blanks into words, but advanced patterns include wildcards for precise control: a single period (.) matches one or more characters until the next template element or end of string, .n matches exactly n characters, and .d matches a single digit. String literals in templates match exact sequences, which can be case-sensitive, and relative positioning like +n skips n characters after a match. Rexx does not support regular expressions in templates, relying instead on these simple yet powerful positional and wildcard rules for common parsing tasks. An example is PARSE VAR line a b c, which splits a string variable line by spaces into three variables; for patterned parsing, PARSE VALUE time() WITH hours '.' mins '.' secs extracts components from a time string like "12.34.56" into hours, mins, and secs. Another is PARSE UPPER ARG word1 .3 rest, which uppercases arguments, assigns the first word to word1, the next three characters to a variable, and the remainder to rest. These mechanisms integrate seamlessly with variables for dynamic content handling, such as building templates from computed values. The INTERPRET instruction enables dynamic execution by evaluating a string expression as Rexx code, effectively treating it as if it were a in the program. Its syntax is simply INTERPRET expression;, where the expression is first evaluated to a , a is appended if absent, and the result is then executed. This allows for runtime , such as constructing s or assignments from ; for example, INTERPRET 'data = 4' assigns the 4 to the variable data. More complex uses include cmd = 'DO 3; SAY "Hello!"; END'; INTERPRET cmd, which outputs "Hello!" three times. However, INTERPRET has limitations: it cannot handle label clauses, partial constructs like a standalone LEAVE without a full , or nested dynamic instructions that alter unexpectedly. Due to its power, INTERPRET poses risks such as if the expression incorporates untrusted input, so it should be used cautiously, often with via TRACE Results or Interactive modes to inspect execution. For simpler evaluations without full instruction execution, the function serves as a safer alternative.

Numeric Operations and Precision

Rexx provides arbitrary- decimal arithmetic, allowing computations with extremely without , controlled primarily through the NUMERIC . This sets the and behavior for operations and comparisons. The NUMERIC DIGITS n clause specifies the number of significant digits for calculations, with a default of 9; conforming implementations must support at least 999, though the maximum is implementation-defined. values below 9 reduce and should be used cautiously to avoid unexpected effects. The NUMERIC FUZZ m clause defines the tolerance for numeric comparisons by ignoring the specified number of least significant digits, with a default of 0 and a maximum equal to the current DIGITS value minus 1; during comparisons, the effective precision is temporarily reduced by the fuzz amount, treating numbers as equal if their difference falls within this tolerance. The NUMERIC FORM clause determines the exponential notation for output: SCIENTIFIC (default, using powers of 10, e.g., 1.23E+4) or ENGINEERING (using powers of 1,000, e.g., 1.23E+3 for 1,230); this affects how results exceeding the displayable digits are formatted when converted to strings. Omitting operands in the NUMERIC instruction displays the current settings, and built-in functions DIGITS(), FUZZ(), and FORM() return these values as strings. Arithmetic operations in Rexx include addition (+), subtraction (-), multiplication (*), division (/ for exact decimal division), integer division (% which truncates toward zero), remainder (//), and exponentiation (** with a non-negative integer exponent). All operations respect the current NUMERIC DIGITS setting for precision, handling big decimals exactly; for example, 12345678901234567890 + 1 yields the precise result without truncation. Division (/) produces results rounded to the current precision, while integer division (%) discards the fractional part toward zero, and remainder (//) follows the sign of the dividend. Invalid operations, such as division by zero, raise errors. Relevant built-in functions support numeric manipulation under the current settings: ABS(number) returns the absolute value, SIGN(number) returns -1 for negative, 0 for zero, or 1 for positive inputs, and TRUNC(number [, n]) truncates to the integer part (default n=0) or to n decimal places, always toward zero. These functions, along with others like FORMAT(), adhere to NUMERIC precision except where specified otherwise. For output in engineering notation, the FORMAT function can specify an exponent type of 'E' to force powers of 1,000 regardless of the NUMERIC FORM setting. To illustrate precision control, consider setting high accuracy for approximations: NUMERIC DIGITS 50 followed by pi = 22 / 7 retains the result as a 50-digit decimal (approximately 3.14285714285714285714285714285714285714285714286), demonstrating exact handling without premature rounding; lowering DIGITS to 5 would yield 3.1429 after rounding. Such capabilities enable precise financial or scientific computations, but users must manage DIGITS to balance accuracy and performance, as higher values increase computation time. Limitations include truncation toward zero in integer division and the TRUNC function, which may differ from rounding behaviors in other languages; Rexx does not natively support numbers or floating-point , relying instead on throughout. Errors occur for non-numeric inputs in contexts, promoting robust numeric handling.

Error Handling and Debugging

Rexx employs a condition-based mechanism for error handling, allowing programs to trap and respond to specific runtime events without a traditional try-catch construct. Conditions such as , , HALT, NOVALUE, and can be trapped using the SIGNAL ON or CALL ON instructions, which enable or disable traps for these events. When a condition occurs, control transfers to a designated internal label, where the program can handle the error, log details, or take corrective action. The SIGNAL ON variant immediately branches to the trap routine and does not return, making it suitable for fatal errors, while CALL ON invokes the routine as a subroutine, allowing execution to resume afterward. The condition is raised when a host command returns a positive return code indicating an error, unless a trap is active. triggers on negative return codes from commands, signifying severe issues like command failures. HALT occurs due to external interruptions, such as user-initiated stops. is raised when referencing an uninitialized simple , helping prevent unintended behaviors in scripting. handles parsing or runtime syntax errors, though it only works with SIGNAL ON. Traps are initially off and can be specified with a label, such as SIGNAL ON NOVALUE NAME badvar, directing flow to the badvar: label upon occurrence. In the handler, the special RC holds the return code for command-related conditions, enabling inspection of the error severity. For example, the following code traps a NOVALUE :
SIGNAL ON NOVALUE NAME trap_novalue
x = y + 1  /* y is uninitialized */
trap_novalue:
  SAY "Variable not set: " RC
  EXIT 1  /* Terminate with [error code](/page/Error_code) */
Here, the trap routine displays a and uses the instruction to end the program, setting the overall return code to 1, which is stored in the invoker's RC variable if applicable. The EXIT instruction unconditionally terminates the exec, optionally specifying a numeric value as the return code to propagate success (0) or failure status back to the caller or environment. In some implementations like Object REXX, handlers can use PROPAGATE to re-raise the up the call chain for further processing. Debugging in Rexx primarily relies on the TRACE instruction, which logs program execution details to aid in identifying issues. TRACE options include ALL, which displays every clause before execution; RESULTS, showing expressions and their outcomes; NORMAL, tracing only errored commands; and OFF to disable tracing. For interactive debugging, the ? prefix pauses at each traced line, allowing step-by-step inspection, while ! inhibits host command execution to test logic safely. Host environments often support interactive modes where TRACE can be toggled dynamically, combined with condition traps for comprehensive error diagnosis. For instance, TRACE ALL followed by SIGNAL ON SYNTAX enables full visibility into syntax errors during development. This facility provides flexible, non-intrusive tools for scripting errors, emphasizing Rexx's suitability for interactive and automated tasks.

References

  1. [1]
    [PDF] The design of the REXX language - IBM z/VM
    REXX is also designed to be highly system independent, but it has the capability of issuing both commands and conventional interlanguage calls to its host ...
  2. [2]
    z/VM History: Timeline
    REXX is a versatile and easy to read programming language that can be used as a scripting, macro, or an application development language. In 1981, Mike ...
  3. [3]
    REXX on z/OS - IBM
    The Restructured Extended Executor (REXX) language is a procedural language that allows programs and algorithms to be written in a clear and structural way.Missing: history | Show results with:history
  4. [4]
    The Rexx Language - Standards
    The 1996 American National Standard (ANSI Standard) for Rexx is called "Programming Language - REXX", and its number is X3.274-1996.
  5. [5]
    The Rexx Language
    An ANSI Standard for Rexx was developed during the 1990's and published in 1996. The standard ensures that compliant interpreters produce results consistent ...
  6. [6]
    Rexx brief history - speleotrove.com
    This new language, initially called REX (because ... 1979, and the first specification for the language is dated 29 March 1979. ... Copyright © Mike Cowlishaw 1979 ...
  7. [7]
    Rexx - the practical programming language - The Register
    23 Jan 2006 · REXX was first developed by Mike between 1979-82 at IBM Hursley in the UK and the T. J. Watson Research Centre in the USA. In 1987, it became ...
  8. [8]
    [PDF] Object REXX Programming Guide - Index of /
    Object REXX is an object-oriented, English-like language with cross-platform versatility, fewer rules, and is interpreted, not compiled.
  9. [9]
    [PDF] The Rexx Language (Background) - speleotrove.com
    Feb 13, 2012 · The NUMERIC instruction may be used to select the arbitrary precision of calculations (you may calculate with one thousand significant ...
  10. [10]
    REXX Programming Language: What it is, Where it's Used, and Why ...
    Oct 11, 2022 · The original name of REXX was simply Rex. The additional X was added to create a more unique name, and so there would be no confusion with other ...Missing: etymology | Show results with:etymology
  11. [11]
  12. [12]
    REXX Inside and Out - File I/O - EDM2
    When Rexx was originally written for IBM's Virtual Machine operating system, it was given no native file handling capabilities. VM has its own file handling ...Missing: limitations | Show results with:limitations
  13. [13]
    [PDF] RXPIPE for z/OS - RexxLA
    Jul 3, 2023 · RXPIPE is not a replacement for the IBM PIPE command, rather it is an attempt to implement what I find the most useful elements of the PIPE ...
  14. [14]
    Why you should consider Rexx for scripting - Opensource.com
    Rexx is arguably the first general-purpose scripting language. It's powerful yet easy to use. By Howard FosdickMissing: revival | Show results with:revival
  15. [15]
    A brief History of 'Classic' Rexx
    This new language, initially called REX (because the name sounded nice) was very much driven by the desire to make programming easy.Missing: etymology | Show results with:etymology
  16. [16]
    REXX - EDM2
    Apr 2, 2025 · The REXX language was created by Mike Cowlishaw in 1979 under VM/CMS. The second implementation (2.00) was used inside IBM in 1980. Language ...Missing: origin name etymology
  17. [17]
    Rexx Language History - speleotrove.com
    Rexx was initially developed from 1979 through 1982 as an internal IBM tool, and was first released as part of the IBM VM/SP3 operating system product in 1983.Missing: 1979-1989 MVS TSO OS/ 2 AIX SAA
  18. [18]
    [PDF] REXX Compiler - RexxLA
    May 1, 2007 · Available to the general public in 1983 VM (3rd release). ▫ 1985 first non-IBM version appears. ▫ 1987 IBM announces Rexx to be the Procedures.
  19. [19]
    [PDF] PROCEEDINGS OF THE REXX SYMPOSIUM FOR DEVELOPERS ...
    Jun 11, 1990 · The first REXX Symposium for Developers and Users was held at t,he. Stanford Linear Accelerator Center on June 11, 1990. Mike Cowlishaw, au ...
  20. [20]
    [PDF] PROCEEDINGS OF THE REXX SYMPOSIUM FOR DEVELOPERS ...
    Keynote Address: REXX 1995 - The Growth of a Language. M. F. Cowlishaw, IBM Fellow. Much of the character of REXX today was determined during the first year ...Missing: timeline | Show results with:timeline
  21. [21]
  22. [22]
    Decimal Arithmetic: Standards and Specifications - speleotrove.com
    Its purpose is to facilitate portability of REXX programs for use on a wide variety of computer systems. Note: Errata also available, as ANSI X3. 274-1996/AM 1 ...
  23. [23]
    [PDF] Announcement of the Regina REXX Interpreter - RexxLA
    Annapolis, May 5, 1992 summary. Regina is a REXX interpreter for Unix systems, written in ANSI C, lex and yacc. The source code for Regina is available by ...
  24. [24]
    IBM Object REXX - EDM2
    Oct 17, 2019 · In 1994 IBM announced that development the Object REXX would replace Classic REXX as the default REXX interpreter in the next release of OS/2.
  25. [25]
    REXXUTIL Information and Samples - EDM2
    Dec 27, 2022 · Contains all the Winxxx calls, the Workplace Shell classes, and their _wpxxx messages. Also this is available as an online doc that comes with ...
  26. [26]
    AmigaOS Manual: ARexx
    Jul 4, 2023 · This manual introduces you to ARexx, tells you how to create ARexx programs and provides a reference section of ARexx commands.Missing: expansion | Show results with:expansion
  27. [27]
    Untitled
    The 2004 International Rexx Symposium will celebrate the 25th anniversary of the Rexx programming language! The Rexx Symposium will be held in Germany this ...
  28. [28]
    Rexx Symposia - RexxLA
    2019. 30th Annual Rexx Symposium - 22 Sep 2019 to 25 Sep 2019 - Hursley, United Kingdom Announcement Call for Presentations Schedule Sponsored by: Aresti ...Missing: 40th anniversary
  29. [29]
    The 2019 International Rexx Symposium. - RexxLA
    This two-and-half-day technical conference will address topics related to the Rexx family of programming languages: Classic Rexx, NetRexx, and Open Object Rexx.Missing: 40th anniversary
  30. [30]
    [PDF] z/OS TSO/E REXX Reference - IBM
    Feb 21, 2021 · This document supports z/OS® (5650-ZOS). This document describes the z/OS TSO/E REXX Interpreter (hereafter referred to as the interpreter ...
  31. [31]
    [PDF] Using REXX and z/OS UNIX System Services - IBM
    This document presents the information you need to write REXX programs that access z/OS UNIX System. Services (z/OS UNIX). It describes the features and ...Missing: strengths prototyping education
  32. [32]
    Use Rexx for scripting in 2023 - Opensource.com
    This article walks you through two example Rexx scripts so you can get a feel for the language. Rexx purports to be highly capable yet easy to work with.Missing: revival | Show results with:revival
  33. [33]
    Regina REXX Interpreter - Browse Files at SourceForge.net
    Download Latest Version Regina396w64.exe (3.2 MB). Email in envelope. Get an email when there's a new version of Regina REXX Interpreter. Next. Home. Name.
  34. [34]
    ooRexx 5.0.0 GA - Rexx Language Association
    23 Dec 2022 ... The ooRexx (open object Rexx) team is pleased to release ooRexx 5.0.0 and make it generally available to the world via the web ...Missing: 2020s | Show results with:2020s
  35. [35]
    Open Object Rexx
    Open Object Rexx version 5.1.0 (beta) is now available. Visit the announcement page for more information. Open Object Rexx version 5.0.0 (GA) is now available.Documentation · About ooRexx · Downloads · Project CharterMissing: 2020s | Show results with:2020s
  36. [36]
    Winter 2025 Mentorship: Building a Rexx Language Server with ...
    May 7, 2025 · I built a VS Code extension for Rexx using Langium, an open-source language engineering tool with support for the Language Server Protocol (LSP).
  37. [37]
    [PDF] 7.3 REXX/VM Reference
    Aug 31, 2022 · This is a reference document containing all of the REXX/VM instructions and functions. They are listed alphabetically in their own sections.
  38. [38]
    Regina Rexx Interpreter
    Regina is a Rexx interpreter that has been ported to most Unix platforms (Linux, FreeBSD, Solaris, AIX, HP-UX, etc.) and also to OS/2, eCS, DOS, Windows/2k/XP/ ...Missing: implementation 1992<|control11|><|separator|>
  39. [39]
    Designing Portable REXX Programs - TechDocs
    Oct 7, 2025 · REXX provides functions for determining the current host environment so that a REXX program designed for portability can trap environment ...
  40. [40]
    ADDRESS - IBM
    TSO/E REXX provides several host command environments that you can use with the ADDRESS instruction. The environments allow you to use different TSO/E, MVS™, ...
  41. [41]
    [PDF] TSO/E REXX User's Guide - IBM
    Jul 10, 2019 · This chapter describes the REXX programming language and some of its features. ... As mentioned earlier, the REXX language has three special ...<|separator|>
  42. [42]
    REXX for CICS Transaction Server: Reference - IBM
    REXX for CICS TS provides a general purpose CICS-based text editor. The REXX editor is provided so that execs and data can be created, updated, and viewed from ...
  43. [43]
    What's new in IBM Developer for z/OS
    The REXX Editor is a modern Eclipse-based editor that provides some of the same features as the Eclipse-based COBOL and PL/I Editors: an outline view of REXX ...
  44. [44]
    Hercules: Integrated Rexx Support
    ... Rexx interpreters provide the ability to directly target the host operating system environment. Both of the ' sh ' and ' exec ' commands are thus disabled ...
  45. [45]
  46. [46]
    Regina REXX Interpreter download | SourceForge.net
    Rating 5.0 (11) · FreeDownload Regina REXX Interpreter for free. An implementation of the the ANSI Standard REXX Programming Language, available for most operating systems.
  47. [47]
  48. [48]
    [PDF] OoRexx 5.1.0 Release Update The 2025 International Rexx ...
    May 4, 2025 · OoRexx 5.1.0 Release Update. The 2025 International Rexx Symposium. Vienna, Austria. May4th – May 7th 2025. Page 2. 2. Rony G. Flatscher.
  49. [49]
  50. [50]
    RexxInfo.org - Free Tutorials, Downloads, Examples, Tools, more
    This site links to all Rexx resources! Rexx is a versatile programming language that combines ease of use with power. It runs on nearly all platforms.
  51. [51]
    REXX for PHP download | SourceForge.net
    Apr 26, 2014 · Download REXX for PHP for free. Open Source of REXX commands for PHP, in includable .php file. Let's you use native REXX commands in your ...
  52. [52]
    [PDF] Rexx Programmer's Reference - 2nd Edition - RexxInfo.org
    In 1979, Mike Cowlishaw, IBM fellow, designed a “human-centric ... rex and *.rexx are processed by Mod_Rexx. ❑. Optionally define Rexx Server ...
  53. [53]
  54. [54]
    Rexx Language Support - Visual Studio Marketplace
    Aug 11, 2025 · The Rexx Language Support plugin leverages the language server protocol to provide syntax awareness, syntax coloring and autocomplete features for Rexx code.
  55. [55]
    CICS Transaction Server for z/OS
    ### Summary of REXX Syntax Rules and Instruction Types
  56. [56]
  57. [57]
    [PDF] REXX/400 Programmer's Guide - RexxInfo.org
    SAY 'This program demonstrates how the REXX "Parse Source" instruction'. SAY ... The ADDRESS instruction changes the command environment from within a REXX.
  58. [58]
    Expressions and operators - IBM
    Expressions in REXX are a general mechanism for combining ... Expression evaluation is from left to right; parentheses and operator precedence modify this.
  59. [59]
    [PDF] Programming Language REXX - RexxLA
    Mar 8, 2020 · This standard provides an unambiguous defi- nition of the programming language REXX. ... complete reference of this standard (ANSI. X3J18-199x) ...
  60. [60]
  61. [61]
    PARSE - IBM
    PARSE assigns data (from various sources) to one or more variables according to the rules of parsing.Missing: documentation | Show results with:documentation
  62. [62]
    INTERPRET - IBM
    INTERPRET processes instructions that have been built dynamically by evaluating expression. Read syntax diagram Skip visual syntax diagram
  63. [63]
    Parsing instructions examples - IBM
    All examples in this section parse source strings into words. ARG /* ARG with source string named in REXX program invocation */ /* Program name is PALETTE.Missing: documentation | Show results with:documentation
  64. [64]
    Advanced parsing information - IBM
    When a REXX program is started as a command, only one argument string is recognized. You can pass multiple argument strings for parsing: When one REXX program ...
  65. [65]
    Precision in REXX - IBM
    Precision is the maximum number of significant digits that can result from an operation. Precision is controlled by the following instruction.
  66. [66]
    NUMERIC - IBM
    NUMERIC FUZZ temporarily reduces the value of NUMERIC DIGITS by the NUMERIC FUZZ value during every numeric comparison.
  67. [67]
    REXX Built-In functions - IBM
    DIGITS, Returns the current setting of NUMERIC DIGITS. ; FORM, Returns the current setting of NUMERIC FORM. ; FUZZ, Returns the current setting of NUMERIC FUZZ.
  68. [68]
    Arithmetic operators - IBM
    REXX arithmetic is performed by the operators + , - , * , / , % , // , and ** (add, subtract, multiply, divide, integer divide, remainder, and power), ...
  69. [69]
    Numbers and arithmetic operations - IBM
    To determine the current settings of the NUMERIC options, use the built-in functions DIGITS, FORM, and FUZZ. These functions return the current settings of ...
  70. [70]
    Built-in Functions - IBM
    The built-in functions work internally with NUMERIC DIGITS 9 and NUMERIC FUZZ 0 and are unaffected by changes to the NUMERIC settings, except where stated.
  71. [71]
    Conditions and condition traps - IBM
    A condition is a specified event or state that CALL ON or SIGNAL ON can trap. A condition trap can modify the flow of execution in a REXX program.Missing: programming debugging documentation
  72. [72]
    z/OS
    ### Summary of EXIT Instruction in Rexx
  73. [73]
    Chapter 11. Conditions and Condition Traps
    A condition is an event or state that CALL ON or SIGNAL ON can trap. A condition trap can modify the flow of execution in a Rexx program. Condition traps ...
  74. [74]
    REXX keyword instruction TRACE - IBM
    This is valid only if the TRACE S clause itself is not nested in any other instruction (including INTERPRET or interactive debug) or in an internal routine.