Skip to main content

Software > Software Development > IBM REXX Family >

NetRexx

Technical detail

Keyword instructions

A keyword instruction is one or more clauses, the first of which starts with a keyword that identifies the instruction. Some keyword instructions affect the flow of control; the remainder just provide services to the programmer. Some keyword instructions (do, if, loop, or select) can include nested instructions.

As can be deduced from the syntax rules described earlier, a keyword instruction is recognized only if its keyword is the first token in a clause, and if the second token is not an '=' character (implying an assignment). It would also not be recognized if the second token started with '(', '[', or '.' (implying that the first token starts a term).

Further, if a current local variable, method argument, or property has the same name as a keyword then the keyword will not be recognized. This important rule allows NetRexx to be extended with new keywords in the future without invalidating existing programs.

Thus, for example, this sequence in a program with no say variable:

  say 'Hello'
say('1')
say=3
say 'Hello'

would be a say instruction, a call to some say method, an assignment to a say variable, and an error.

In NetRexx, therefore, keywords are not reserved; they may be used as the names of variables (though this is not recommended, where known in advance).

Certain other keywords, known as sub-keywords, may be known within the clauses of individual instructions -- for example, the symbols to and while in the loop instruction. Again, these are not reserved; if they had been used as names of variables, they would not be recognized as sub-keywords.

Blanks adjacent to keywords have no effect other than that of separating the keyword from the subsequent token. For example, this applies to the blanks next to the sub-keyword while in

  loop  while  a=3

Here at least one blank was required to separate the symbols forming the keywords and the variable name, a. However the blank following the while is not necessary in

  loop while 'Me'=a

though it does aid readability.

Details

 

 

PreviousTable of contents Next
We're here to help
Easy ways to get the answers you need.
E-mail us

or call us at
877-426-3774
Priority code:
104CBW67