Originally developed for mainframes but highly portable across platforms-from servers to desktops to handhelds-Rexx is an easy yet powerful scripting language that's widely used for rapid application development. Covers Rexx interpreters for specialized functions-object-oriented, mainframe, and handheld. Two Simple REXX WWW CGI Scripts. Get your Web-Master to add a rule to the Web server's rules file to allow the Web server to execute your script. More information on the W3C server's rules file may be found by looking at Configuration File of W3C httpd, as well as a simple example of some of the mapping statements usable in the rules file. Test Your Job Interview Skills' Thank you for taking the time to interview with us, but we've decided to hire someone else. Answering this job interview question wrong could cost you your new job! Good tool when you're using someone else's computer. Send a check if you're standing on a hillside or otherwise inclined. Originally developed for mainframes but highly portable across platforms-from servers to desktops to handhelds-Rexx is an easy yet powerful scripting language that's widely used for rapid application development. - Selection from Rexx Programmer's Reference [Book].
Paradigm | multiparadigm: procedural, structured |
---|---|
Designed by | Mike Cowlishaw |
Developer | Mike Cowlishaw, IBM |
First appeared | 1979; 40 years ago |
Stable release | |
Typing discipline | Dynamic |
Filename extensions | .cmd, .bat, .exec, .rexx, .rex, EXEC |
Major implementations | |
VM/SP, TSO/E V2, SAAREXX, ARexx, BREXX, Regina,[1] Personal REXX, REXX/imc | |
Dialects | |
NetRexx, Object REXX, now ooREXX, KEXX | |
Influenced by | |
PL/I, ALGOL, EXEC, EXEC 2 | |
Influenced | |
NetRexx, Object REXX | |
|
2) Rexx tools using TSO & ISPF commands/macro to help in analysis. With a command, all the copybooks of cobol module will be expended there itself. This helps in analysis. 3) Loads of tools to help in analysis. Full cross reference of jobs, procs and cobol programs; job flow chart tools; cobol program to put long called-calling chain into some simple format etc. Say ' rexx tool to check jcl syntax & coding standard'. IBM Mainframe Forum is the official sister site of IBM Mainframe Computer Portal and not affiliated with IBM. Secure Coding; Tools; Share; Print; Overview; Research. XP COBOL copy-book expansion tool. COBOL Code Tagger in Rexx Q. What is the role of Modification Tags in a COBOL Program? I put the TAG Rexx source code under.
Rexx (Restructured Extended Executor) is an interpretedprogramming language developed at IBM by Mike Cowlishaw.[2][3] 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.[4]
Rexx is used as a scripting and macro language, and is often used for processing data and text and generating reports; these similarities with Perl mean that Rexx works well in Common Gateway Interface (CGI) programming and it is indeed used for this purpose. Rexx is the primary scripting language in some operating systems, e.g. OS/2, MVS, VM, AmigaOS, and is also used as an internal macro language in some other software, such as SPFPC, 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 ActiveX scripting engines languages (e.g. 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.3 and later, where it is officially named Procedures Language/2), AmigaOS Version 2 on up, PC DOS (7.0 or 2000), and Windows NT 4.0 (Resource Kit: Regina). REXX scripts for OS/2 share the filename extension .cmd with other scripting languages, and the first line of the script specifies the interpreter to be used. REXX macros for REXX-aware applications use extensions determined by the application. In the late 1980s, Rexx became the common scripting language for IBM Systems Application Architecture, where it was renamed 'SAA Procedure Language REXX'.
A Rexx script or command is sometimes referred to as an EXEC in a nod to the CMS file type used for EXEC,[5]EXEC 2[6] and REXX scripts on CP/CMS and VM/370 through z/VM.
- 2History
- 3Syntax
- 3.1Looping
- 3.6Keyword instructions
- 3.7Error handling and exceptions
Features[edit]
Rexx has the following characteristics and features:
- Simple syntax
- The ability to route commands to multiple environments
- The ability to support functions, procedures and commands associated with a specific invoking environment.
- A built-in stack, with the ability to interoperate with the host stack if there is one.
- Small instruction set containing just two dozen instructions
- Freeform syntax
- Case-insensitive tokens, including variable names
- Character string basis
- Dynamic data typing, no declarations
- No reserved keywords, except in local context
- No include file facilities
- Decimal arithmetic, floating-point
- A rich selection of built-in functions, especially string and word processing
- Automatic storage management
- Crash protection
- Content addressable data structures
- Straightforward access to system commands and facilities
- Simple error-handling, and built-in tracing and debugger
- Few artificial limitations
- Simplified I/O facilities
- Unconventional operators
- Only partly supports Unix style command line parameters, except specific implementations
- Provides no basic terminal control as part of the language, except specific implementations
- Provides no generic way to include functions and subroutines from external libraries, except specific implementations
Rexx has just twenty-three, largely self-evident, instructions (such as call
, parse
, and select
) with minimal punctuation and formatting requirements. It is essentially an almost free-form language with only one built into them which allows control of the application from Rexx. One single Rexx script could even switch between different Rexx ports in order to control several running applications.
In 1990, Cathie 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 1992, the two most widely used open-source ports appeared: Ian Collier's REXX/imc for Unix and Anders Christensen's Regina[1] (later adopted by Mark Hessling) for Windows and Unix. BREXX is well known for WinCE and Pocket PC platforms, and has been 'back-ported' to VM/370 and MVS.
OS/2 had a visual development system from Watcom VX-REXX another dialect was VisPro REXX from Hockware.
Portable Rexx by Kilowatt and Personal Rexx by Quercus are two Rexx interpreters designed for DOS and can be run under Windows as well using a command prompt. Since the mid-1990s, two newer variants of Rexx have appeared:
- NetRexx: 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 1996 American National Standards Institute (ANSI) published a standard for Rexx: ANSI X3.274–1996 'Information Technology – Programming Language REXX'.[11] More than two dozen books on Rexx have been published since 1985.
Rexx marked its 25th anniversary on 20 March 2004, which was celebrated at the REXX Language Association's 15th International REXX Symposium in Böblingen, Germany, in May 2004.
On October 12, 2004, IBM announced their plan to release their Object REXX implementation's sources under the Common Public License. Recent releases of Object REXX contain an ActiveX WSH scripting engine implementing this version of the Rexx language.
On February 22, 2005, the first public release of Open Object Rexx (ooRexx) 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.
As of January 2017 REXX was listed in the TIOBE index as one of the fifty languages in its top 100 not belonging to the top 50.[12]
Toolkits[edit]
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, RxxxEd, has been developed for Windows.[13] RxSock for network communication as well as other add-ons to and implementations of Regina Rexx have been developed, and a Rexx interpreter for the Windows command line is supplied in most Resource Kits for various versions of Windows and works under all of them as well as DOS.
Spelling and capitalization[edit]
Originally the language was called Rex (Reformed Executor); the extra 'X' was added to avoid collisions with other products' names. 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 eXtended eXecutor was used for the system product in 1984.[7]
Syntax[edit]
Looping[edit]
The loop control structure in Rexx begins with a DO
and ends with an END
but comes in several varieties. NetRexx uses the keyword LOOP
instead of DO
for looping, while ooRexx treats LOOP
and DO
as equivalent when looping.
Conditional loops[edit]
Rexx supports a variety of traditional structured-programming loops while testing a condition either before (do while
) or after (do until
) the list of instructions are executed:
Repetitive loops[edit]
Like most languages, Rexx can loop while incrementing an index variable and stop when a limit is reached:
The increment may be omitted and defaults to 1. 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:
Rexx can even loop until the program is terminated:
A program can break out of the current loop with the leave
instruction, which is the normal way to exit a do forever
loop, or can short-circuit it with the iterate
instruction.
Combined loops[edit]
Most unusually, Rexx allows both conditional and repetitive elements to be combined in the same loop:[14]
Conditionals[edit]
Tool To Check Christmas Lights
Testing conditions with IF
:
Bank Check Coding
The ELSE
clause is optional.
For single instructions, DO
and END
can also be omitted:
Indentation is optional, but it helps improve the readability.
Testing for multiple conditions[edit]
SELECT
is Rexx's CASE structure, like many other constructs derived from PL/I. 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.
The NOP
instruction performs 'no operation', and is used when the programmer wishes to do nothing in a place where one or more instructions would be required.
The OTHERWISE clause is optional. If omitted and no WHEN conditions are met, then the SYNTAX condition is raised.
Simple variables[edit]
Variables in Rexx are typeless, and initially are evaluated as their names, in upper case. Thus a variable's type can vary with its use in the program:
Compound variables[edit]
Unlike many other programming languages, classic Rexx has no direct support for arrays of variables addressed by a numerical index. Instead it provides compound variables.[15] A compound variable consists of a stem followed by a tail. A . (dot) is used to join the stem to the 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.1 = 9, stem.2 = 8, stem.3 = 7
..
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.
After these assignments the term stem.3
would produce '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.0
is often used to keep track of how many items are in a stem, for example a procedure to add a word to a list might be coded like this:
It is also possible to have multiple elements in the tail of a compound variable. For example:
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.
and then later:
At the cost of some clarity it is possible to combine these techniques into a single stem:
and later:
Password protect an excel file. If you forget the password, you cannot unprotect the worksheet or workbook.
Rexx provides no safety net here, so if one of the words happens to be a whole number less than dictionary.0
this technique will fail mysteriously.
Recent implementations of Rexx, including IBM's Object REXX and the open source implementations like ooRexx include a new language construct to simplify iteration over the value of a stem, or over another collection object such as an array, table or list.
Keyword instructions[edit]
PARSE[edit]
The PARSE
instruction is particularly powerful; it combines some useful string-handling functions. Its syntax is:
where origin specifies the source:
The option to translate this page is provided via third party application. The ODPS/BMV cannot guarantee the accuracy of the translation made available through this service. Bmv prices. No Cost: You may pay for your BMV transactions at any deputy registrar license agency or reinstatement center with cash, check, money order or credit card. The following are applicable Deputy Registar license agency fees. Retain License Plate Number (This fee is charged. 2 Revised Ohio Bureau of Motor Vehicles; Archive Fee. How can the answer be improved? Home Ohio Drivers License & ID Renewing Your License. Our goal is to give you the most up-to-date, accurate information about your state DMV's processes. The date you see here reflects the most recent time we've verified this information with your state DMV.
arg
(arguments, at top level tail of command line)linein
(standard input, e.g. keyboard)pull
(Rexx data queue or standard input)source
(info on how program was executed)value
(an expression)with
: the keywordwith
is required to indicate where the expression endsvar
(a variable)version
(version/release number)
and template can be:
- list of variables
- column number delimiters
- literal delimiters
upper
is optional; if specified, data will be converted to upper case before parsing.
Examples:
Using a list of variables as template
displays the following:
Using a delimiter as template:
also displays the following:
Using column number delimiters:
displays the following:
A template can use a combination of variables, literal delimiters, and column number delimiters.
INTERPRET[edit]
The INTERPRET instruction evaluates its argument and treats its value as a Rexx statement. Sometimes INTERPRET is the clearest way to perform a task, but it is often used where clearer code is possible using, e.g., value()
.
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.
This displays 16 and exits. 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:
A slightly more sophisticated 'Rexx calculator':
PULL
is shorthand for parse upper pull
. 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[edit]
Calculates √2 | Calculates e | |
---|---|---|
code | ||
output | sqrt 2 = 1.414213562373095048801688724209698078569671875377 | e = 2.7182818284590452353602874713526624977572470936998 |
SIGNAL[edit]
The SIGNAL instruction is intended for abnormal changes in the flow of control (see the next section). 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[edit]
It is possible in Rexx to intercept and deal with errors and other exceptions, using the SIGNAL instruction. 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:
A signalonnovalue
statement 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[edit]
Tool To Check Blood Pressure
ERROR
- Positive RC from a system command
FAILURE
- Negative RC for a system command (e.g. command doesn't exist)
HALT
- Abnormal termination
NOVALUE
- An unset variable was referenced
NOTREADY
- Input or output error (e.g. read attempts beyond end of file)
SYNTAX
- Invalid program syntax, or some other error condition
LOSTDIGITS
- Significant digits are lost (ANSI Rexx, not in TRL second edition)
When a condition is handled by SIGNAL ON
, the SIGL
and RC
system variables can be analyzed to understand the situation. 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:
See also[edit]
References[edit]
- ^ abMark Hessling (2012-10-25). 'Regina Rexx Interpreter'. SourceForge project regina-rexx. Retrieved 2014-02-10.
- ^ abcM. F. Cowlishaw. 'IBM REXX Brief History'. IBM. Retrieved 2006-08-15.
- ^ abMelinda Varian. 'REXX Symposium, May 1995'.
- ^'Catalog of All Documents (filter=rexx)'. IBM library server. 2005. Retrieved 2014-02-10.
- ^IBM Virtual Machine Facility /370: EXEC User's Guide(PDF) (Second ed.). International Business Machines Corporation. April 1975. GC20-1812-1.
- ^EXEC 2 Reference(PDF) (Second ed.). International Business Machines Corporation. April 1982. p. 92. SC24-5219-1.
- ^ abM. F. Cowlishaw (1984). 'The design of the REXX language'(PDF). IBM Systems Journal, VOL 23. NO 4, 1984 (PDF). IBM Research. p. 333. doi:10.1147/sj.234.0326. Retrieved 2014-01-23.
Could there be a high astonishment factor associated with the new feature? If a feature is accidentally misapplied by the user and causes what appears to him to be an unpredictable result, that feature has a high astonishment factor and is therefore undesirable. If a necessary feature has a high astonishment factor, it may be necessary to redesign the feature.
- ^M. F. Cowlishaw (1981-02-18). 'REX -- A Command Programming Language'. SHARE. Retrieved 2006-08-15.
- ^Lundin, Leigh; Woodruff, Mark (1987-04-23). 'T/REXX, a REXX compiler for CMS'. U.S. Copyright Office. Washington, DC: Independent Intelligence Incorporated (TXu000295377).
- ^'Rexx Implementations'. RexxLA. Archived from the original on 2006-09-24. Retrieved 2006-08-15.
- ^While ANSI INCITS 274-1996/AMD1-2000 (R2001) and ANSI INCITS 274-1996 (R2007) are chargeable, a free draft can be downloaded: 'American National Standard for Information Systems – Programming Language REXX'(PDF). X3J18-199X.
- ^'The Next 50 Programming Languages'. TIOBE index. tiobe.com. 2017. Archived from the original on 2017-01-19. Retrieved 2017-01-10.
- ^Howard Fosdick (2005). Rexx Programmer's Reference. Wiley Publishing. p. 390. ISBN0-7645-7996-7.
- ^M. F. Cowlishaw (1990). The Rexx Language - A Practical Approach to Programming (2nd ed.). Prentice Hall. ISBN0-13-780651-5.
- ^http://www.uic.edu/depts/accc/software/regina/rexxrule.html#p02h24
Further reading[edit]
- Callaway, Merrill. The ARexx Cookbook: A Tutorial Guide to the ARexx Language on the Commodore Amiga Personal Computer. Whitestone, 1992. ISBN978-0963277305.
- Callaway, Merrill. The Rexx Cookbook: A Tutorial Guide to the Rexx Language in OS/2 & Warp on the IBM Personal Computer. Whitestone, 1995. ISBN0-9632773-4-0.
- Cowlishaw, Michael. The Rexx Language: A Practical Approach to Programming. Prentice Hall, 1990. ISBN0-13-780651-5.
- Cowlishaw, Michael. The NetRexx Language. Prentice Hall, 1997. ISBN0-13-806332-X.
- Daney, Charles. Programming in REXX. McGraw-Hill, TX, 1990. ISBN0-07-015305-1.
- Ender, Tom. Object-Oriented Programming With Rexx. John Wiley & Sons, 1997. ISBN0-471-11844-3.
- Fosdick, Howard. Rexx Programmer's Reference. Wiley/Wrox, 2005. ISBN0-7645-7996-7.
- Gargiulo, Gabriel. REXX with OS/2, TSO, & CMS Features. MVS Training, 1999 (third edition 2004). ISBN1-892559-03-X.
- Goldberg, Gabriel and Smith, Philip H. The Rexx Handbook . McGraw-Hill, TX, 1992. ISBN0-07-023682-8.
- Goran, Richard K. REXX Reference Summary Handbook. CFS Nevada, Inc.,1997. ISBN0-9639854-3-4.
- IBM Redbooks. Implementing Rexx Support in Sdsf. Vervante, 2007. ISBN0-7384-8914-X.
- Kiesel, Peter C. Rexx: Advanced Techniques for Programmers. McGraw-Hill, TX, 1992. ISBN0-07-034600-3.
- Marco, Lou ISPF/REXX Development for Experienced Programmers. CBM Books, 1995. ISBN1-878956-50-7
- O'Hara, Robert P. and Gomberg, David Roos. Modern Programming Using Rexx. Prentice Hall, 1988. ISBN0-13-597329-5.
- Rudd, Anthony S. 'Practical Usage of TSO REXX'. CreateSpace, 2012. ISBN978-1475097559.
- Schindler, William. Down to Earth Rexx. Perfect Niche Software, 2000. ISBN0-9677590-0-5.
External links[edit]
Wikimedia Commons has media related to REXX (programming language). |
- REXX language page at IBM
- Rexx programming language at Open Hub