After completing this session, you will be able to:
Explain the varieties of REXX
Describe the features of REXX
List the components of REXX
REXX (REstructured eXtended eXecutor) programming language was first created in 1979, as a very high level scripting language that had a particularly strong facility for text processing tasks.
Since REXX's inception, IBM has included versions of REXX with most of its operating systems -- all the way from its mainframes, to its mid-level systems; to end user OS's like OS/2 and PC-DOS.
Other OS makers, such as Amiga, have also integrated REXX as an always-available system scripting language. A number of ISVs, moreover, have created REXX environments for many platforms. Somewhat late in the game, ANSI officially adopted a standard for REXX in 1996.
REXX is a programming language that is extremely versatile. The TSO/E implementation of the REXX language allows REXX execs to run in any MVS address space.
A REXX exec consists of REXX language instructions that are interpreted directly by the REXX interpreter or compiled directly by a REXX language compiler and executed by a compiler runtime processor. An exec can also contain commands that are executed by the host environment.
Classic REXX is the procedural language that's been with us for two decades. Classic REXX distinguishes itself by combining power with ease of learning and ease of use.
Object-oriented REXX is a superset of classic REXX. It fully supports object-oriented scripting with classes, messaging, single and multiple inheritance, encapsulation and data hiding, operator overloading and polymorphism and a robust class library. Any classic REXX script runs under object REXX and staff can easily transfer their skills to object REXX. Object REXX brings REXX's ease of use to object-oriented scripting.
NetREXX is a REXX-like language for scripting in Java environments. It represents the third variety of REXX. NetREXX scripts use Java classes and can be used to create classes used by Java programs. One can develop applets, applications, servlets, and Enterprise Java beans with NetREXX.
REXX's distinguishing characteristic is that it combines ease of use with power. It's as easy to learn as Basic or PHP, but it has the power required to run mainframe data centers. It's good at text manipulation and is particularly well-suited for issuing operating system commands. It's an excellent alternative to the Windows shell language and makes a nice complement to difficult-to- master scripting languages like Perl and Linux's Bourne-Again shell. Its advantages over Microsoft technologies like Visual Basic and VBScript are that it is standardized, non-proprietary, and cross- platform.
The features which make REXX stand apart from other languages are -
The REXX language is easy to read and write because many instructions are meaningful English words. Unlike some lower level programming languages that use abbreviations, REXX instructions are common words, such as SAY, PULL, IF... THEN... ELSE..., DO... END and EXIT
There are few rules about REXX format. You need not start an instruction in a particular column, you can skip spaces in a line or skip entire lines, you can have an instruction span many lines or have multiple instructions on one line, variables do not need to be predefined, and you can type instructions in upper, lower, or mixed case.
REXX supplies built-in functions that perform various processing, searching, and comparison operations for both text and numbers. Other built-in functions provide formatting capabilities and arithmetic calculations.
TSO/E implements the REXX language as an interpreted language. When a REXX exec runs, the language processor directly processes each language statement. Languages that are not interpreted must be compiled into machine language and possibly link-edited before they are run.
REXX includes extensive parsing capabilities for character manipulation. This parsing capability allows you to set up a pattern to separate characters, numbers, and mixed input.
The various components of REXX are what make it a powerful tool for programmers. REXX is made up of:
There are five types of instructions, which are as follows. All but commands are processed by the language processor.
Command (both TSO/E REXX commands and host commands)
These functions are built into the language processor and provide convenient processing options.
These functions are provided by TSO/E and interact with the system to do specific tasks for REXX.
A data stack can store data for I/O and other types of processing.
REXX is a proven language that has a world-wide following and offers a lot to those programming their desktops, laptops, and handhelds. Aspects such as common programming structure, readability, and free format make it a good language for beginners and general users. As REXX can be intermixed with commands to different host environments, it provides powerful functions and has extensive mathematical capabilities and it is also suitable for more experienced computer professionals.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!