When
using ordinals, keep in mind the following:
- Ordinals are strongly-typed; that
is, an ordinal can only be compared with or assigned to another
ordinal of the same type. The ordinal must have been explicitly
declared in a DECLARE statement.
- The ordinal-type-name in a DEFINE ORDINAL statement cannot used
in comparisons or assignments.
- Ordinals can be passed/received as arguments/parameters like
any other data type.
- Ordinals are invalid as arguments for all built-in functions
requiring arguments with computational types. However, in support
of ordinals, built-in functions have been defined and BINARYVALUE
has been extended. These built-in functions are listed in Table 23, and their descriptions can be found in Built-in functions, pseudovariables, and subroutines..
Each of the built-in functions listed takes exactly one argument,
which must be a reference having type ORDINAL.
Table 23. Ordinal-handling built-in functions
| Function |
Description |
| BINARYVALUE |
Converts an ordinal to a binary
value |
| ORDINALPRED |
Returns the next lower value for
an ordinal |
| ORDINALSUCC |
Returns the next higher value for
an ordinal |
| ORDINALNAME |
Returns a character string giving
an ordinal’s name |
For example, in the following sample code, the first DO loop
below would list, in ascending order, the members of the Color set; the
second DO loop would list them in descending order. The example
uses the ordinal definition from Example.
|
This information center is powered by Eclipse technology. (http://www.eclipse.org)