Structure and general syntax

If you store a REXX exec in a data set that is allocated to SYSPROC, the exec must start with a comment and the comment must contain the characters "REXX" within the first line (line 1) of the exec. This is known as the REXX exec identifier and is required in order for the TSO/E EXEC command to distinguish REXX execs from TSO/E CLISTs, which are also stored in SYSPROC.

The characters "REXX" must be in the first line (line 1) even if the comment spans multiple lines. In Figure 1, example A on the left is correct. The program starts with a comment and the characters "REXX" are in the first line (line 1). Example B on the right is incorrect. The program starts with a comment. However, although the comment contains the characters "REXX", they are not in the first line (line 1).
Figure 1. Example of using the REXX exec identifier
     Example A (Correct)                     Example B (Incorrect)

/* REXX program to check ...            /* This program checks ...
   ...  The program then ... */            ... in REXX and ...      */
ADDRESS CPICOMM                         ADDRESS CPICOMM
   ...                                     ...
   ...                                     ...
   ...                                     ...
EXIT                                    EXIT

If the exec is in a data set that is allocated to a file containing REXX execs only, not CLISTs (for example, SYSEXEC), the comment including the characters "REXX" is not required. However, it is suggested that you start all REXX execs with a comment in the first column of the first line and include the characters "REXX" in the comment. In particular, this is suggested if you are writing REXX execs for use in other SAA environments. Including "REXX" in the first comment also helps users identify that the program is a REXX program and distinguishes a REXX exec from a TSO/E CLIST. For more information about how the EXEC command processor distinguishes REXX execs and CLISTs, see z/OS TSO/E Command Reference.

A REXX program is built from a series of clauses that are composed of:
  • Zero or more blanks (which are ignored)
  • A sequence of tokens (see Tokens)
  • Zero or more blanks (again ignored)
  • A semicolon (;) delimiter that can be implied by line-end, certain keywords, or the colon (:)

Conceptually, each clause is scanned from left to right before processing, and the tokens composing it are identified. Instruction keywords are recognized at this stage, comments are removed, and multiple blanks (except within literal strings) are converted to single blanks. Blanks adjacent to operator characters and special characters (see Tokens) are also removed.