Note: This tutorial considers a program to be a series of instructions, whereas Rexx language documents use a refinement -- a series of clauses. A clause is an instruction, or a sub-instruction within an instruction grouping construct; such as, if...then...else, select when...then... otherwise... end, or do...end . The notion of clauses has particular significance in the context of trace activities, where instructions and sub-instructions are traced. For those that are learning Rexx it is easier to consider a program to be a series of instructions; as programs in other languages are. These other languages may use the notion of statement rather than an instruction.
Rexx instructions are sequences of tokens that precede an instruction terminator. Many Rexx instructions start with a reserved instruction keyword (in any character case), in which case the instruction is generally classified as a keyword instruction. There are two exceptions. If the second token of the instruction begins with an equal sign (=), the instruction is classified as an assignment instruction. If the second token of the instruction is a colon (:), the combination is treated as a label and classification of the instruction proceeds with the tokens that follow the colon. When the instruction is neither an assignment instruction, nor a recognized keyword instruction, then the instruction is classified as a system command.
Note: if a function call starts where an instruction is expected, the instruction is processed as a command! You should be particularly careful if you use isolated function calls in other programming languages; such as, C, C++, C#, Java, etc. BUT THERE IS A SPECIAL CASE !!. If the instruction begins with a reserved keyword instruction token, the instruction will not be treated as a command, even if the keyword is immediately followed by a left parenthesis, which in all other cases would be treated as a function invocation. Here is an example of this special case.
pattern = '-->' arg( pattern ) rest
The 2nd instruction above is an arg instruction. The left parenthesis begins a pattern matching template term.
There are other reserved keywords that can appear where an instruction is expected to begin. These have special meaning within their context. These other special keywords are: then, else, when, otherwise, and end.
The following is the list of keywords associated with keyword instructions.