|
5.4 HIGH-VALUES and LOW-VALUES
There are occasions when you may wish to set a variable to an infinitely high or infinitely
low number. For example, suppose you were merging two files on surnames as the primary key:
In this example, when IN-NAME-1 is less than IN-NAME-2 (based on their ASCII values e.g. A < B etc..)
then the FILE-1 record (RECORD-1) is written to the merge file (RECORD-OUT). One of FILE-1 and FILE-2
will come to an end before the other so the completed file has its IN-NAME-_ value set to constant that will
ALWAYS be greater than the IN-NAME-_ value still being read, ensuring all remain files are written to the
merge file. This is done with the lines: MOVE HIGH-VALUES TO IN-NAME-1 and MOVE HIGH-VALUES TO IN-NAME-2
It is important to note that HIGH-VALUES and LOW-VALUES are ALPHANUMERIC in type, so you can't
set numerically defined variables to this type (you would have to
implicitly redefine the variable first). This is an annoying quirk of COBOL.
|