HP COBOL II Language Operators [ Symbolic Debugger/iX User's Guide ] MPE/iX 5.0 Documentation
Symbolic Debugger/iX User's Guide
HP COBOL II Language Operators
The following table lists the supported HP COBOL II operators. Operators
are listed in order of precedence, from highest to lowest. All operators
listed in the same box are of equal precedence. All operators of equal
precedence evaluate left to right, except assignment.
Associativity of operators in the following table is from left to right,
unless otherwise stated.
Table E-1. Language Operators for HP COBOL II
---------------------------------------------------------------------------------------------
| | |
| Operator | Operation |
| | |
---------------------------------------------------------------------------------------------
| | |
| ( ) | parenthesis, group elements |
| | |
| * | multiplication |
| | |
| / | division |
| | |
| + | addition |
| | |
| - | subtraction |
| | |
---------------------------------------------------------------------------------------------
| | |
| < | relational less than |
| | |
| > | relational greater than |
| | |
| <= | relational less than or equal to |
| | |
| >= | relational greater than or equal to |
| | |
| = | relational equal to |
| | |
| < > | relational not equal to |
| | |
---------------------------------------------------------------------------------------------
| | |
| AND | logical and |
| | |
| OR | logical or |
| | |
---------------------------------------------------------------------------------------------
| | |
| NOT | unary logical negation |
| | |
---------------------------------------------------------------------------------------------
| | |
| move | assignment |
| | |
---------------------------------------------------------------------------------------------
Dereferencing Operations
There are two supported HP COBOL II dereferencing operations, field
dereferencing (variable qualification) and array dereferencing.
Field Dereferencing.
There are two operators that are supported for field dereferencing
(variable qualification):
* .
* of
The difference in these operators is the order in which the fields are
listed. The . (dot) operator is used to specify a qualified path from
the parent field down; the of operator is used to specify the path from
the child field up. For example, in the pseudo-COBOL structure:
01 fob
02 bar
03 stooge
04 curly
04 moe
04 larry
02 bat
03 marx
04 harpo
04 chico
04 groucho
the fully qualified path to print chico would be either of the two
commands listed below.
disp fob.bat.marx.chico
OR
disp chico of marx of bat of fob
It is not always necessary to fully qualify a field; the minimum list of
parent fields that uniquely identify the field will suffice. In other
words, if there is only one field named "chico" in all the variables in
the current subprogram, then disp chico is sufficient. Suppose, however,
you had the following structure.
01 fob
02 bar
03 marx
04 harpo
04 chico
04 groucho
02 bat
03 marx
04 harpo
04 chico
04 groucho
With this structure, chico would not be unique, nor would marx.chico.
The minimum qualification necessary is either:
disp bat.chico
OR
disp chico of bat
If a name is fully qualified such as fob.bat.marx.chico, it must always
be unique.
Array Dereferencing.
HP COBOL subscripts applied to a structure are always listed at the end
of the field list. For example, using this structure:
01 fob
02 bar
03 stooge
04 curly
04 moe
04 larry
02 bat
03 marx
04 harpo
04 chico
04 groucho
If fob and marx were tables, a valid expression might be:
fob.bat.marx.chico(3,7)
The debugger determines to which fields the subscripts apply. The more
conventional form:
fob(3).bat.marx(7).chico
is NOT legal.
MPE/iX 5.0 Documentation