Web Site

Computerit-solutions.com



» Computer » Large computer » Topics begins with R » REXX


Page modified: Friday, June 23, 2006 20:28:51

REXX (Abk. f. Restructured Extended Executor) is one of Mike Cowlishaw with IBM developed script language.

Origin

REXX originates from the large computer range. Mike Cowlishaw had first implemented it into the 1980er years as a successor of the script language EXEC-2 under VM (the difference between the relatively simple and not very powerful EXEC-2 and REXX is just as large as between the MS-DOS batch language and BASIC). REXX stands thereby for "“REstructured eXtended eXecutor"” (LANGUAGE). REXX was portiert on TSO and other environments such as OS/2. An adapted version - called ARexx - enjoyed also on the Amiga of large likingness, since almost each important program thereby is "“remote controlable"”. Meanwhile also interpreters for nearly all environments are available up to the PalmOS. 1996 became REXX the ANSI standard (ANSI X3.274-1996 "“information Technology - Programming LANGUAGE REXX"”).

REXX can be particularly easily extended, as DLLs are in addition-loaded to the actual interpreter. In particular under OS/2 variety of such libraries with mathematical, data base, Socket and system functions is available, like normal REXX the functions to be addressed is usually an interpreted language, but on IBM large computers also REXX compilers are available.

Fundamental concepts

Everything is a stringer

In classical Rexx (in contrast to here the not treated, however compatible object-oriented Rexx) each value is a stringer -- also-pay! It is thus easily possible to change numerical values with stringer manipulations and to use those result immediately again as number: A = 2 A = A || "“00"” say A/2 through appendices of two zeros A "“is multiplied"” by 100; the result, the character string 200, can be used immediately again as number. Spent wird200.

Logically the work with stringers is very simple in Rexx. The above could have been written aucha = a'00'. One or more blanks between A and '00 ' however would have led to the fact that with the implicit concatenation a blank would be inserted -- which is surely unwanted, if the result is a number.

If a number is needed, because the used operator with numbers works, Rexx tries, to interpret the available value as number: say "“1"” + 2 actually spends 3!

Under normal conditions Rexx on 9 decimal places counts exactly; by indication of a higher number can be counted however nearly arbitrarily exactly. It lies near that these few hardware near method Rexx not necessarily when language for very computer-bound problems predestines.

Analysis logic

Rexx was developed among other things, in order to be able to set commands off in a simple manner to an environment. This supported by the following strategy during the evaluation of an instruction, which makes Rexx programs insensitive in relation to again introduced keywords and an however position characteristic of the language are:

1. If second token begins with an equals sign, it concerns a value assignment

From this it follows that e.g.

if = 1

a valid instruction is, which assigns the value 1 to the variable IF! However would be

if == 1

a valid logical expression, which examines whether the variable has if accurately the value 1; as independent instruction it results in however a syntax error, because the value = 1 which can be assigned is evenly no valid expression.

2. If second token is a colon, it concerns a mark

Marks are needed, in order to realize procedures and functions; one notes these in Rexx after the "“executable part " of the program. Example:

say: radio ("“you x"”) exit radio: return bad (1)

One could expect that you x is spent to the standard output. The keyword say functions here however only as mark; the expression radio ("“you x"”) the next instruction in accordance with rule 4 (see below) is form already called thus radio and handed over to you x for the execution to the environment. (Would be naturally also without those function radio; this only as very simple example of a function call)

It is also possible to head for with signal VALUE expression a certain mark; this is rather only in certain cases meaningfully, e.g. as alternative too much large instructions for SELECT.

3. If first token is the keyword, the evaluation takes place according to this instruction for keyword

Such keywords are e.g. if, DO, say. One notes that this rule makes Rexx very much: Future versions of the language can introduce new keywords, without existing programs must revised: both variables and marks can keep their name!

4. In every other case the instruction than expression is evaluated and the result is handed over to the environment

This means that the following Rexx instruction (under DOS, Windows, OS/2"…) contents of the-current listing spends: you or also: "“you"” in the first case is you a variable; if you were not assigned value, then her value YOU (its name in capital letters) is, and it to YOU to the environment will hand over and implemented. Handed over implemented in the second case guarantees you and.

It could be natural that a future Rexx version introduces a keyword you. In order to make sure that Programmauch still functions then, it can be forced e.g. through '' you that the instruction is recognized as a sign (concatenation with the emptying ring).

The universal loop

Contrary to other programming languages all loops begin with DO with REXX. The organization of this DO-LOOP can be very various.

If one needs a firm consequence of instructions (e.g. for that to then or else part of a conditioned instruction), then can it these into a DO END block be combined: to DO Anweisung1 Anweisung2 Anweisung3"… AnweisungN end

limited number of repetitions

If a loop a firmly given number is to be gone through, then one can indicate an expression, which determines the number of repetitions behind the DO (example): to DO 5 say "“hello"” end

It is spent five times "“hello"”

Counter cycle

DO index=start tons ends by to incrementation say index ends

The counting variable may after the locking ends to be repeated; the variable indicated here is not released correct, sowird a syntax error:

DO index=start tons ends by to incrementation say index ends to index

This is a great help, in order to retain in interlocked loops the overview.

While loop

(Condition is queried at the loop beginning and must be an expression, which results in the value 0 or 1) to i=0 DO while condition i=i+1 say i end

Until loop

(Condition is queried at the loop end) to i=11 DO until condition i=i-1 say i end sharpens

Continuous loop (with optional abort condition)

to DO more forever if abort condition then leave end

iterate and leave

For use in loops there are the special branch statements iterate and leave. Example:

DO index=1 if index == 3 then iterate index if index > 5 then leave say index end to index

Iterate jumps to the loop beginning (comparable the continue of other programming languages), while the leave loop leaves (comparably BREAK). The instruction the counting variable is again optional; in addition it makes the controlling possible of interlocked loops. In the example one spends: 1 2 4 5

Array and Stems

REXX is very flexible. REXX does not know explicit variable declarations, and also no arrays. Nevertheless a array-similar structure can be produced easily by the fact that variables are indicated:

DO i = 1 ton 10 zahl.i = 10 - i end to zahl.0 = i - 1/* => 10; by convention * DO i = 1 ton of zahl.0 say i') 'zahl.i end to i

Afterwards the following variables with the following allocation exist: zahl.1 = 9, zahl.2 = 8, zahl.3 = 7"… by convention is put down under the index 0 the number of stored elements. With drop number. can then all eleven variables of the form zahl.i with an impact be removed.

This kind of the variables is called Stem variables; the first part including the first point is called Stem, the remainder as Tail. The Tail can consist also of several symbols, which are separated by points; in this way also multidimensional arrays can be realized. The values of the used symbols can be arbitrary; they are not limited at all to numbers.

A group of matching variables can be initialized by value assignment at the Stem, e.g.: Option. = 0 Option.0verbose = 1 say Option.0ther/* => 0 * in the Tail were selected here intentionally constants, which began with a number and which have thereby unalterable values 0VERBOSE and 0THER; thus it is guaranteed that no errors inclusively-calibrate themselves by the fact that one gets used variable a value in the Tail assigned.


Articles in category "REXX"

We found here 2 articles.

R

» RACF
» REXX

Related Websites

We found here 5 related websites.

  • Regina Cross-Platform Rexx Interpreter
    Open source, ported to most Unix and desktop platforms. Maintained by Mark Hessling.

  • Rexx FAQ
    03 Jan 2004 - Updated links to the TSO/Rexx FAQ and Rexx Style Guide ... 18 May 2001 - Added meaning of Rexx since it's an often asked question ...

  • The Rexx Language
    IBM's official Rexx site. With news, background, books, tutorials, documentation and extensive links.

  • The Rexx Language Association
    The Rexx Language Association. With symposion information, ANSI standard and large link collection....

  • Wikipedia: REXX
    Encyclopedia article about the scripting language.

Page cached: Wednesday, July 5, 2006 14:11:06
Valid XHTML 1.0!  Valid CSS!

Navigation

Related articles


Page copy protected against web site content infringement by Copyscape