SELECT instruction


Syntax:

  SELECT ... WHEN ... OTHERWISE ... END

As in Rexx, with the addition of LABEL and PROTECT on the SELECT clause. CATCH and FINALLY can be used (see "Exceptions" section for details).

If a LABEL is specified on the SELECT, then a LEAVE which specifies that label may be used to leave the SELECT construct, and the END that ends the SELECT may optionally specify the label of SELECT for added checking. For example:

  select label roman
    when a=b then say 'egal'
    when a<b then say 'lo'
    otherwise
      say 'hi'
      if a=0 then leave roman
      say 'a non-0'
    end roman

In this example, if the variable A has the value 0 and B is non-zero then just 'hi' is displayed.

If PROTECT is given on the SELECT it is followed by a term that must resolve to an object reference; while the SELECT construct is being executed, the object is protected -- that is, the code in the SELECT construct has exclusive access to the object.

Both PROTECT and LABEL may be specified, if needed.


[ previous section | contents | next section ]

From 'netrexx.doc', version 1.00.
Copyright(c) IBM Corporation, 1996, 1997. All rights reserved. ©