Introduction to the REXX Language. REXX is an interpretive language; the REXX interpreter operates directly on the program as it executes, line-by-line and word-by-word. Running a Rexx Program. Rexx programs should have a file extension of.rex (the default searched for by the ooRexx interpreter). Here is a typical Rexx program named. Rexx Information -- Downloads, tools, tutorials & reference, plus Object Rexx and NetRexx. In this series of articles, I’ll provide a beginner’s guide to the REXX* programming language on z/OS*. Let’s head straight into reading and writing files.
Hello World REXX Program Tutorial Author: Greg Shah Revision Date: October 3. HELLO.CMD is the most trivial possible REXX program. The following is its entire source. REXX REFERENCE MANUAL (TSO). A Rexx program can be written far more quickly than one for COBOL or Assembler, for the same task at hand. HR Software - Webbasiert, innovativ, international. Modulare Personalsoftware f REXX/400 Programmer’s Guide Version 4 SC41-5728-00. AS/400 Advanced Series IBM REXX/400 Programmer’s Guide. Calling an ILE/C Program From REXX.
Rexx - Wikipedia. Rexx. Paradigmmultiparadigm: procedural, structured. Designed by. Mike Cowlishaw. Developer. Mike Cowlishaw, IBMFirst appeared.
Stable release. ANSI X3. Typing discipline. Dynamic. Filename extensions. Major implementations. VM/SP, TSO/E V2, SAAREXX, ARexx, BREXX, KEXX, Regina. It is a structured, high- level programming language designed for ease of learning and reading. Proprietary and open source REXX interpreters exist for a wide range of computing platforms; compilers exist for IBM mainframe computers.
Rexx is the primary scripting language in some operating systems, e. OS/2, MVS, VM, Amiga. OS, and is also used as an internal macro language in some other software, such as KEDIT, THE and the ZOC terminal emulator. Additionally, the Rexx language can be used for scripting and macros in any program that uses Windows Scripting Host Active. X scripting engines languages (e. VBScript and JScript) if one of the Rexx engines is installed. Rexx is supplied with VM/SP on up, TSO/E Version 2 on up, OS/2 (1.
Procedures Language/2), Amiga. OS Version 2 on up, PC DOS (7. Windows NT 4. 0 (Resource Kit: Regina). REXX scripts for OS/2 share the filename extension . REXX macros for REXX- aware applications use extensions determined by the application.
In the late 1. 98. Rexx became the common scripting language for IBM Systems Application Architecture, where it was renamed .
It is essentially an almost free- form language with only one data- type, the character string; this philosophy means that all data are visible (symbolic) and debugging and tracing are simplified. Rexx's syntax looks similar to PL/I, but has fewer notations; this makes it harder to parse (by program) but easier to use, except for cases where PL/I habits may lead to surprises. One of the REXX design goals was the principle of least astonishment. As such, Rexx is considered a precursor to Tcl and Python. Rexx was also intended by its creator to be a simplified and easier to learn version of the PL/I programming language. However, some differences from PL/I may trip up the unwary.
It was first described in public at the SHARE 5. Houston, Texas, in 1. The first compiler version appeared in 1. CMS by Lundin and Woodruff. Many Amiga applications have an .
One single Rexx script could even switch between different Rexx ports in order to control several running applications. In 1. 99. 0, Cathy Dager of SLAC organized the first independent Rexx symposium, which led to the forming of the REXX Language Association. Symposia are held annually. Several freeware versions of Rexx are available.
In 1. 99. 2, the two most widely used open- source ports appeared: Ian Collier's REXX/imc for Unix and Anders Christensen's Regina (later adopted by Mark Hessling) for Windows and Unix. BREXX is well known for Win. CE and Pocket PC platforms, and has been . Since the mid- 1. Rexx have appeared: Net. Rexx: compiles to Javabyte- code via Java source code; this has no reserved keywords at all, and uses the Java object model, and is therefore not generally upwards- compatible with 'classic' Rexx. Object REXX: an object- oriented generally upwards- compatible version of Rexx.
In 1. 99. 6 American National Standards Institute (ANSI) published a standard for Rexx: ANSI X3. Recent releases of Object REXX contain an Active. X WSH scripting engine implementing this version of the Rexx language. On February 2. 2, 2. Open Object Rexx (oo.
Rexx) was announced. This product contains a WSH scripting engine which allows for programming of the Windows operating system and applications with Rexx in the same fashion in which Visual Basic and JScript are implemented by the default WSH installation and Perl, Tcl, Python third- party scripting engines. A command- line Rexx interpreter is also installed with oo. Rexx, and it is also possible to run oo. Rexx. Script programs from the command line by means of the CScript command (WScript may also be run from the command line) invoking the Windows Scripting Host. Rexx/Tk, a toolkit for graphics to be used in Rexx programmes in the same fashion as Tcl/Tk is widely available.
A Rexx IDE, Rxxx. Ed, has been developed for Windows. REX was originally all uppercase because the mainframe code was uppercase oriented. The style in those days was to have all- caps names, partly because almost all code was still all- caps then.
For the product it became REXX, and both editions of Mike Cowlishaw's book use all- caps. The expansion to REstructured e. Xtended e. Xecutor was used for the system product in 1. Net. Rexx uses the keyword LOOP instead of DO for looping, while oo. Rexx treats LOOP and DO as equivalent when looping.
Conditional loops. The limit can also be omitted, which makes the loop continue forever.
Rexx permits counted loops, where an expression is computed at the start of the loop and the instructions within the loop are executed that many times: doexpression. Like some implementations of CASE constructs in other dynamic languages, Rexx's WHEN clauses specify full conditions, which need not be related to each other. In that, they are more like cascaded sets of IF- THEN- ELSEIF- THEN- ..- ELSE code than they are like the C or Java switch statement. If omitted and no WHEN conditions are met, then the SYNTAX condition is raised. Simple variables.
Thus a variable's type can vary with its use in the program: sayhello/* => HELLO */hello=2. Instead it provides compound variables. A compound variable consists of a stem followed by a tail. If the tails used are numeric, it is easy to produce the same effect as an array.
Afterwards the following variables with the following values exist: stem. Unlike arrays, the index for a stem variable is not required to have an integer value. For example, the following code is valid: In Rexx it is also possible to set a default value for a stem.
Unknown'stem. 1='USA'stem. UK'stem. 3. 3='France'After these assignments the term stem. Unknown'. The whole stem can also be erased with the DROP statement. This also has the effect of removing any default value set previously. By convention (and not as part of the language) the compound stem. For example: m='July'd=1. Friday'Multiple numerical tail elements can be used to provide the effect of a multi- dimensional array.
Features similar to Rexx compound variables are found in many other languages (including associative arrays in AWK, hashes in Perl and Hashtables in Java). Most of these languages provide an instruction to iterate over all the keys (or tails in Rexx terms) of such a construct, but this is lacking in classic Rexx.
Instead it is necessary to keep auxiliary lists of tail values as appropriate. For example, in a program to count words the following procedure might be used to record each occurrence of a word. Sometimes INTERPRET is the clearest way to perform a task, but it is often used where clearer code is possible using, e. The other reasons being Rexx's (decimal) arbitrary precision arithmetic (including fuzzy comparisons), use of the PARSE statement with programmatic templates, stemmed arrays, and sparse arrays.
Because variable contents in Rexx are strings, including rational numbers with exponents and even entire programs, Rexx offers to interpret strings as evaluated expressions. This feature could be used to pass functions as function parameters, such as passing SIN or COS to a procedure to calculate integrals. Rexx offers only basic math functions like ABS, DIGITS, MAX, MIN, SIGN, RANDOM, and a complete set of hex plus binary conversions with bit operations. More complex functions like SIN had to be implemented from scratch or obtained from third party external libraries. Some external libraries, typically those implemented in traditional languages, did not support extended precision. Later versions (non- classic) support CALL variable constructs. Together with the built- in function VALUE, CALL can be used in place of many cases of INTERPRET.
This is a classic program: /* terminated by input . Likewise, ARG is shorthand for parse upper arg. The power of the INTERPRET instruction had other uses. The Valour software package relied upon Rexx's interpretive ability to implement an OOP environment. Another use was found in an unreleased Westinghouse product called Time Machine that was able to fully recover following a fatal error. NUMERIC. However, it can be misused and treated like the GOTO statement found in other languages (although it is not strictly equivalent, because it terminates loops and other constructs).
This can produce difficult- to- read code. Error handling and exceptions. There are seven system conditions: ERROR, FAILURE, HALT, NOVALUE, NOTREADY, LOSTDIGITS and SYNTAX. Handling of each can be switched on and off in the source code as desired. The following program will run until terminated by the user: signalonhalt; doa=1saya. This intercepts uses of undefined variables, which would otherwise get their own (upper case) name as their value. Regardless of the state of the NOVALUE condition, the status of a variable can always be checked with the built- in function SYMBOL returning VAR for defined variables.
The VALUE function can be used to get the value of variables without triggering a NOVALUE condition, but its main purpose is to read and set environment variables, similar to POSIXgetenv and putenv. Conditions. RC contains the Rexx error code and SIGL contains the line number where the error arose. Beginning with Rexx version 4 conditions can get names, and there's also a CALL ON construct.
That's handy if external functions do not necessarily exist: Change. Code. Page: procedure/* protect SIGNAL settings */signalonsyntaxname. Change. Code. Page. Trap. return. Sys. Query. Process. Code. Page()Change. Code. Page. Trap: return.
OS/2 */See also. Source. Forge project regina- rexx. IBM Systems Journal, VOL 2. Could there be a high astonishment factor associated with the new feature?