---
rexxpub:
  defaults: rony.yaml
  logo: rexx
---

<!-- 010_ooRexx_V18.odp (2026-10-15 09:33) -->

<!-- slide # 1 (2026-10-15 09:33) ----------------------------- ODP slide # 1 -->
. slide cover
# Procedural and Object-oriented Programming 1

. subtitle
**Overview, Statements, Comparisons, Branches, Repetition**

. cover-art
. picture img/010_ooRexx_V18/p01-diagram-7.png

<!-- slide # 2 (2026-10-15 09:33) ----------------------------- ODP slide # 2 -->
# Why REXX and ooRexx?

- Human-centered language (simple syntax)
    - easy syntax and therefore *quick* to learn
. click
- Powerful object-model
    - All important concepts of the object-oriented paradigm available
. click
- Scripting language
    - Automation ("remote controlling") of applications and operating systems like Linux (D-Bus) or Windows (Windows Scripting Engine)
. click
- BSF4ooRexx (Java-Bridge)
    - All of Java immediately available camouflaged as ooRexx
. click
- Easy entry into other programming languages (e.g.: Java, Python)

<!-- slide # 3 (2026-10-15 09:33) ----------------------------- ODP slide # 3 -->
# Resources

. after
- Course materials
    - Slides:   [http://wi.wu.ac.at/rgf/wu/lehre/autowin/material/foils](http://wi.wu.ac.at/rgf/wu/lehre/autowin/material/foils)
. click
- Related seminar, diploma, bachelor and master theses
    - [https://wi.wu.ac.at/rgf/diplomarbeiten/](https://wi.wu.ac.at/rgf/diplomarbeiten/)
. click
- Book
    - Flatscher R.G.: "Introduction to Rexx and ooRexx &ndash; From Rexx to Open Object Rexx (ooRexx)", facultas Management Book Service
. after
- Browser based ooRexx workbench with numerous examples and debugging abilities by Josep Maria Blasco
  * ooRexx Playground: [https://rexx.epbcn.com/oorexx-wasm/](https://rexx.epbcn.com/oorexx-wasm/)
.click
- More goodies from Josep Maria Blasco
  * Josep Maria's GitHub: [https://github.com/JosepMariaBlasco](https://github.com/JosepMariaBlasco)



<!-- slide # 4 (2026-10-15 09:33) ----------------------------- ODP slide # 4 -->
# Getting ooRexx (as of 2025-09-05)

- Rexx Language Association (non-profit SIG): [https://www.RexxLA.org](https://www.RexxLA.org)
. click
- Latest ooRexx (beta versions are usually stable, fully productive)
    - Installation packages (needs administration rights)
        - [https://sourceforge.net/projects/oorexx/files/oorexx/](https://sourceforge.net/projects/oorexx/files/oorexx/)
    - **Considerations:**
        - **Operating System:** Linux, MacOS or Windows
        - **Bitness:** 32bit (Linux, Windows) or 64bit (Linux, MacOS, Windows)
        - **Architecture:** x86, ARM, Apple M1, ...
. click
- Resources at WU:
    - Virtual PC labs:  [https://labconnect.wu.ac.at/](https://labconnect.wu.ac.at/)
    - FAQ:    [https://learn.wu.ac.at/open/distanzlehre/de/virtuellpc](https://learn.wu.ac.at/open/distanzlehre/de/virtuellpc)

<!-- slide # 5 (2026-10-15 09:33) ----------------------------- ODP slide # 5 -->
# History

- 1979 – Mike F. Cowlishaw (IBM-Fellow)
    . after
    - **REXX**: Acronym for "**RE**structured e**X**tended e**X**ecutor"
    . after
    - Human-centric successor of “EXEC” language on IBM mainframes
    . after
    - Interactive (interpreter)
    . after
    - Keywords are English, resulting code looks like pseudo-code!
    . after
    - No reserved keywords unlike many other programming languages!
. click
- 1987 – IBM’s System Application Architecture (SAA)
    - Procedural script language for all IBM platforms
    - Commercial and open source versions available for all operating systems
. click
- 1996 – ANSI/INCITS "Programming Language – REXX" (INCITS 274:1996\[S2008\])

<!-- slide # 6 (2026-10-15 09:33) ----------------------------- ODP slide # 6 -->
# History

- Since 1990s – Development of an object-oriented REXX
    - Fully compatible with classic ("procedural") REXX but still with a simple syntax
    - Internally fully object-oriented (classic REXX statements are transformed)
    - Powerful object model (e.g. meta-classes, multiple inheritance)
. click
- 1996 – Mike F. Cowlishaw development of NetREXX
    - NetRexx-programs are translated into Java byte code
    - Simpler programming of the Java VM (\~30% less Code)
    - IBM handed over source code to RexxLA ([http://www.RexxLA.org/](http://www.RexxLA.org/))
        - June, 8th, 2011 opensource released by RexxLA

<!-- slide # 7 (2026-10-15 09:33) ----------------------------- ODP slide # 7 -->
# History

- May 2004 – Negotiations about open-sourcing Object Rexx
    - IBM: Manfred Schweizer, manager of IBM's REXX development team
    - RexxLA: Pam Taylor (experienced commercial manager, USA), Mark Hessling (maintainer of Regina and author of numerous Rexx libraries, Australia), Rony G. Flatscher (MIS professor, Austria/Europe)
- October 2004 – Object REXX → "Open Object REXX" (ooRexx)
- April 2005 – RexxLA releases the opensource version of ooRexx
- ooRexx 5.2.0 released in May 2026
    - BSF4ooRexx850 a bridge between ooRexx and Java is available
    - ooRexx 5.2.0 released, work on ooRexx 5.3.0 has started
    - Work on bridges from ooRexx to .NET, Python, Lua, and JavaScript started

<!-- slide # 8 (2026-10-15 09:33) ----------------------------- ODP slide # 8 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (2.26. SAY)"
# Minimal REXX-Program

- The Hello World program is a tradition that dates back to 1974.

  ```rexx
  /* a comment */
  SAY "Hello, my beloved world"
  ```

  . click label
  Output:

  . after
  ```output
  Hello, my beloved world
  ```

<!-- slide # 9 (2026-10-15 09:33) ----------------------------- ODP slide # 9 -->
. slide kicker=Basics
# Notation of Program Text

- Upper or lowercase spelling irrelevant
    - All characters of a statement will be translated into uppercase and executed
. click blanks=all
- Exception: Contents of a string remains unchanged
    - Strings are delimited by apostrophes (`'`) or by quotes (`"`)

      . click
      ```rexx
      "Richard", 'Richard', "\{[]}\gulp!öäüß!{niX }"
      ```

. click blanks=all
- Multiple blank characters between symbols are reduced to one blank, removed around operators
    . click
    - Example:

      . with  blanks=all
      ```rexx
      saY    "\{[]}\gulp!öäüß!{niX }"   reverse(  Abc )
      ```

    . click
    - Becomes:

      . with blanks=all
      ```rexx
      SAY "\{[]}\gulp!öäüß!{niX }" REVERSE(ABC)
      ```

<!-- slide # 10 (2026-10-15 09:33) --------------------------- ODP slide # 10 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (1.10. Structure and General Syntax)"
# Characters

- Characters outside of strings and comments must be from the following character set
    - Blank
    - **a** thru **z**
    - **A** thru **Z**
    - **0** thru **9**
    - Exclamation mark (**!**), backslash (**\\**), question mark (**?**), equal sign (**=**), comma (**,**), minus (**-**), plus (**+**), dot (**.**), Slash (**/**), parentheses (**()**), square brackets (**\[\]**), asterisk (**\***), tilde (**\~**), semicolon (**;**), colon (**:**) and underscore (**\_**)

<!-- slide # 11 (2026-10-15 09:33) --------------------------- ODP slide # 11 -->
. slide kicker=Basics
# Variables

- Variables allow storing, changing, and retrieving strings with the help of a discretionary name called an *identifier*

  . blanks
  ```rexx
  A = "Hello, my beloved world"
  a="Hello, my beloved variable"
  A        =       a        "- changed again."
  say a
  ```

  . click label
  Output:

  . with blanks
  ```output
  Hello, my beloved variable - changed again.
  ```

. click
- Identifiers must begin with a letter, an exclamation mark, a question mark or an underline character, followed by one or more of these characters, digits, and dots.

<!-- slide # 12 (2026-10-15 09:33) --------------------------- ODP slide # 12 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (3.4. ::CONSTANT)"
# Constants

- Constants never get their values changed
- It is possible to use literals which are string constants appearing verbatim in an expression
    - If one wishes to name constants, then there are a few possibilities available, e.g.
        a) [The constant value is assigned to a variable, the value of which never gets changed in the entire program (after all, it is a constant!)]{.fragment}

           . after
           ```rexx
           Pi = 3.14159
           ```

        b) [In ooRexx use the `::constant name value`{.rexx} directive]{.fragment}

<!-- slide # 13 (2026-10-15 09:33) --------------------------- ODP slide # 13 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (1.10.3. Comments)"
# Comments

- Comments may be nested and are allowed to span multiple lines.

  ```rexx
  say 3    +   /* This /**/ is
        a /* nested
             /* aha */ comment */ which spans
           multiple lines */ 4
  ```

  . click label
  Output:

  . with
  ```output
  7
  ```

. click
- Line comments: at the end of a statement, comments follow after two consecutive dashes:

  . with
  ```rexx
  say 3 + 4 -- this yields "7"
  ```

  . click label
  Output:

  . with
  ```output
  7
  ```

<!-- slide # 14 (2026-10-15 09:33) --------------------------- ODP slide # 14 -->
. slide kicker=Basics
# Statements

- Statements consist of all characters up to and including the semi-colon (**;**)
. click
- There may an arbitrary number of statements on a line
. click
- If the semi-colon is missing, then the end of a statement is assumed by the end of a line

  . after
  ```rexx
  /* Some comment */
  SAY "Hello, my dear world";
  ```

  . click label
  Output:

  . with
  ```output
  Hello, my dear world
  ```

<!-- slide # 15 (2026-10-15 09:33) --------------------------- ODP slide # 15 -->
. slide kicker=Basics
# Statements

- Statements may span multiple lines, but you need to indicate this with the continuation character
    - A dash (**-**) or comma (**,**) as the very last character on the line

. click level=1
```rexx
/* Some comment */
SAY "Hello," -
     "my beloved world";
```

. click label level=1
Output:

. with level=1
```output
Hello, my beloved world
```

<!-- slide # 16 (2026-10-15 09:33) --------------------------- ODP slide # 16 -->
. slide kicker=Basics
# Block

- A block is a statement, which may comprise an arbitrary number of statements
. click
- A block starts with the keyword **DO** and ends with **END**

. columns 6 6 ruled level=1

. click
```rexx
DO;
     SAY "Hello," ;
     SAY "world" ;
END;
```


. next column

. click
```rexx
DO
     SAY "Hello,"
     SAY "world"
END
```

. end columns

. with label level=1
Output:

. click level=1
```output
Hello,
world
```

<!-- slide # 17 (2026-10-15 09:33) --------------------------- ODP slide # 17 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (1.11.2.3. Comparison)"
# Comparisons (`test_expression`)

- Two values (constant, variable, results of function calls) can be compared with the following (Infix) operators (Result: **0**=false or **1**=true)

  . plain steps level=1
  | | |
  |---|---|
  | `=` | `equal` |
  | `<>` `\=` | `unequal` |
  | `<` | `smaller` |
  | `<=` | `smaller than` |
  | `>` | `greater` |
  | `>=` | `greater than` |

. click
- Negation of Boolean (**0**=false, **1**=true) values

  . plain steps each=with level=1
  | | |
  |---|---|
  | **\\** | **Negator** |

<!-- slide # 18 (2026-10-15 09:33) --------------------------- ODP slide # 18 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (1.11.2.4. Logical (Boolean))"
# Comparisons (`test_expression`)

- Boolean values can be combined

  . plain level=1
  | | |
  |---|---|
  | `&` | `"and" (true: if both arguments are true)` |
  | `|` | `"or"  (true: if either argument is true)` |
  | `&&` | `"exclusive or" (true: if one argument is true and the other is false)` |

. click
- Boolean combinations can be evaluated in a specific order if enclosed in parentheses:

  . with plain tight

  | | |
  |---|---|
  | ` 0 & 1  | 1`{.rexx} | `Result: 1 (= true)`{.output} |
  | `(0 & 1) | 1`{.rexx} | `Result: 1 (= true)`{.output} |
  | ` 0 & (1 | 1)`{.rexx} | `Result: 0 (= false)`{.output} |


<!-- slide # 19 (2026-10-15 09:33) --------------------------- ODP slide # 19 -->
. slide kicker=Basics
# Comparisons (`test_expression`)

. plain tight steps=cells
| | |
|---|---|
| `a=1`{.rexx} |  |
| `b=2`{.rexx} |  |
| `x="Anton"`{.rexx} |  |
| `y=" Anton  "`{.rexx} |  |
| `If a = 1 then ...`{.rexx} | `Result: 1 (= true)`{.output} |
| `If a = a then ...`{.rexx} | `Result: 1 (= true)`{.output} |
| `If a >= b then ...`{.rexx} | `Result: 0 (= false)`{.output} |
| `If x = y then ...`{.rexx} | `Result: 1 (= true)`{.output} |
| `If x == y then ...`{.rexx} | `Result: 0 (= false)`{.output} |
| `  a <= b & (a = 1 | b > a)`{.rexx} | `Result: 1 (= true)`{.output} |
| `\(a <= b & (a = 1 | b > a))`{.rexx} | `Result: 0 (= false)`{.output} |
| `\a`{.rexx} | `Result: 0 (= false)`{.output} |

<!-- slide # 20 (2026-10-15 09:33) --------------------------- ODP slide # 20 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (2.10. IF)"
# Branch

- A branch determines which statement (block) should be executed as a result of a comparison (of a Boolean value)
    - `IF test_expression=.true THEN statement;`{.rexx}

      . click
      ```rexx
      IF age < 19 THEN SAY "Young."
      ```

. click
- A branch can also determine what alternative statement (block) should be executed, in case the Boolean value is false
    - `IF test_expression=.true THEN statement; ELSE statement;`{.rexx}

      . click
      ```rexx
      IF age < 19 THEN SAY "Young."
                   ELSE SAY "Old."
      ```

      . click
      ```rexx
      IF age < 1 THEN
      DO
           SAY "Hello,"
           SAY "my beloved world"
      END
      ```

<!-- slide # 21 (2026-10-15 09:33) --------------------------- ODP slide # 21 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (2.27. SELECT)"
# Branch

- **Multiple selections (SELECT)**

  ```rexx
  SELECT
     WHEN test_expression THEN statement;
     WHEN test_expression THEN statement;
        /* ... additional WHEN-statements */
     OTHERWISE statement;
  END
  ```

  . click label
  Example:

  . with
  ```rexx
  SELECT
     WHEN age = 1   THEN SAY "Baby." ;
     WHEN age = 6   THEN SAY "Elementary school kid." ;
     WHEN age >= 10 THEN SAY "Big kid." ;
     OTHERWISE SAY "Unimportant." ;
  END
  ```

<!-- slide # 22 (2026-10-15 09:33) --------------------------- ODP slide # 22 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (2.4. DO)"
# Repetition

- A block can be executed repeatedly

  ```rexx
  DO 3
       SAY "Aua!"
       SAY "Oh!"
  END
  ```

  . click label
  Output:

  . after numbered steps=0,1-2,3-4,5-6 each=after
  ```output
  Aua!
  Oh!
  Aua!
  Oh!
  Aua!
  Oh!
  ```

<!-- slide # 23 (2026-10-15 09:33) --------------------------- ODP slide # 23 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (2.4. DO)"
# Repetition

- Using a variable to control the number of repetitions

  ```rexx
  a = 3
  ...
  DO a
       SAY "Aua!"; SAY "Oh!"
  END
  ```

  . click label
  Output:

  . after numbered steps=0,1-2,3-4,5-6 each=after
  ```output
  Aua!
  Oh!
  Aua!
  Oh!
  Aua!
  Oh!
  ```

<!-- slide # 24 (2026-10-15 09:33) --------------------------- ODP slide # 24 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (2.4. DO)"
# Repetition

- Repetition using a loop variable ("**i**" in this example)

  ```rexx
  DO i = 1 TO 3
       SAY "Aua!"; SAY "Oh!" i
  END
  ```

  . click label
  Output:

  . after numbered steps=0,1-2,3-4,5-6 each=after
  ```output
  Aua!
  Oh! 1
  Aua!
  Oh! 2
  Aua!
  Oh! 3
  ```

<!-- slide # 25 (2026-10-15 09:33) --------------------------- ODP slide # 25 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (2.4. DO)"
# Repetition

- Repetition using a loop variable ("**i**" in this example)

  ```rexx
  DO i = 1 TO 3 BY 2
       SAY "Aua!"; SAY "Oh!" i
  END
  ```

  . click label
  Output:

  . after numbered steps=0,1-2,3-4 each=after
  ```output
  Aua!
  Oh! 1
  Aua!
  Oh! 3
  ```

<!-- slide # 26 (2026-10-15 09:33) --------------------------- ODP slide # 26 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (2.4. DO)"
# Repetition

- Repetition using a control variable ("**i**" in this example)

  ```rexx
  DO i = 3.1 TO 5.7 BY 2.1
       SAY "Aua!"; SAY "Oh!" i
  END
  ```

  . click label
  Output:

  . after numbered steps=0,1-2,3-4 each=after
  ```output
  Aua!
  Oh! 3.1
  Aua!
  Oh! 5.2
  ```

<!-- slide # 27 (2026-10-15 09:33) --------------------------- ODP slide # 27 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (2.4. DO)"
# Repetition

- Conditional repetition (evaluated at the beginning of the block)

  ```rexx
  i = 2
  DO WHILE i < 3
       SAY "Aua!";SAY "Oh!" i
       i = i + 1
  END
  ```

  . click label
  Output:

  . with
  ```output
  Aua!
  Oh! 2
  ```

<!-- slide # 28 (2026-10-15 09:33) --------------------------- ODP slide # 28 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (2.4. DO)"
# Repetition

- Conditional repetition (evaluated at the beginning of the block)

  ```rexx
  i = 3
  DO WHILE i < 3
       SAY "Aua!";SAY "Oh!" i
       i = i + 1
  END
  ```

  . click label
  Output:

[**→** No output, because block is not executed!]{.fragment .afterPrevious}

<!-- slide # 29 (2026-10-15 09:33) --------------------------- ODP slide # 29 -->
. slide kicker=Basics reference="Cf. rexxref.pdf (2.4. DO)"
# Repetition

- Exit condition (evaluated at the end of the block)

  ```rexx
  i = 3
  DO UNTIL i > 1
       SAY "Aua!";SAY "Oh!" i
       i = i + 1
  END
  ```

  . click label
  Output:

  . with
  ```output
  Aua!
  Oh! 3
  ```

<!-- slide # 30 (2026-10-15 09:33) --------------------------- ODP slide # 30 -->
. slide kicker=Basics
# Execution, 1

. col 2 2
```rexx
/* */
 a = 3
 b = "4"
 say a  b
 say a b
 say a ||b
 say a ||b + 3
 say a + b
```

. click label
Output:

. numbered steps=0,1,2,3,4,5
```output
3 4
3 4
34
37
7
```

. click
. next column
. blanks=all
```rexx
/* */
 a = 3
 b = "4"
 say a  b
 say a b
 say a ||b
 say a ||b + 3
 say a + b
```
. end columns


<!-- slide # 31 (2026-10-15 09:33) --------------------------- ODP slide # 31 -->
. slide kicker=Basics
# Execution (Commands), 2

```rexx
/* */
"del *.*"
```

. with
**or:**

. click
```rexx
/* */
ADDRESS SYSTEM "del *.*"
```

. with
**or:**

. click
```rexx
/* */
a = "del *.*"
a
```

. with
**or:**

. click
```rexx
/* */
a = "del *.*"
ADDRESS SYSTEM a
```

<!-- slide # 32 (2026-10-15 09:33) ----------- business card (not in the ODP) -->
. slide card logo=none
# Contact