The text read off it
[page 22]
Condition-Names
In many cases, a record can be processed in one of several ways, depending on certain characteristics of the record or the existence of a particular condition at the time it is processed. For example, assume that a company is using a file of personnel records to prepare a report on employees' dependency status. The records of single employees will probably be processed in a different manner from those of married employees. It might also be essential to distinguish between married and divorced employees. Thus, each record must be examined individually to determine marital status. Marital status would normally be indicated by a code of some kind, and, for the purposes of this illustration, it will be supposed that the initials M, S, and D indicate the classifications (i.e., the "conditions") "married," "single," and "divorced," respectively.
One of these initials will appear in each record, and the programmer must reserve a place in storage for this code by giving a general name to the area in which the code is to be placed. This is done by writing an entry in the data description, as explained in Chapter 4. (See, in particular, the discussion beginning on page 71, in which the reader is shown how a data description for this example may be written.) Assume that the general name used is MARITAL.STATUS. This is a data-name, and it may be used in procedure statements in any of the ways in which data-names may be used. However, in this case, it is desired to name, in addition, the specific values which this data-name represents. Specifically, the programmer will wish to be able to refer to the initials M, S, and D.
If he wishes, he may write a relational expression such as has been shown above. Thus, MARITAL.STATUS = 'M' is a relational expression, and it may be used in such an instruction as IF MARITAL.STATUS = 'M' THEN DO TABULATION.ROUTINE.A. (Note, incidentally, that the initial M is placed in quotation marks to show that it is a literal, for this code will appear literally in the record.)
However, it is often simpler to treat the appearance of a particular code in the assigned area as a condition; this condition can then be given a condition-name which signifies that the condition is present. The condition-name MARRIED, for example, could then be used to indicate the presence of the initial M. Condition-names are assigned in the data description, and the reader is referred again to Chapter 4 to see how this may be done.
Once a condition-name has been defined, it may be used directly in procedure statements. The condition-name actually serves as an abbreviation of a relational expression. In this example, the condition-name MARRIED is exactly equivalent to MARITAL.STATUS = 'M' and it may be substituted for it wherever the programmer wishes. The instruction mentioned above (IF MARITAL.STATUS = 'M' THEN DO TABULATION.ROUTINE.A) can then be reduced to IF MARRIED THEN DO TABULATION.ROUTINE.A.
Similarly, all of the other conditions which the field MARITAL.STATUS can assume are defined in the data description and given condition-names, assuming the programmer has need of them. (If the programmer needs to refer only to the condition MARRIED, he need not assign condition-names to the other conditions.)
The reader should note that the condition-name itself is a conditional expression in the full meaning of that term. It may be used in clauses and sentences in the same manner as any other conditional expression. The most general use of a condition-name is in a clause of the IF . . . THEN type, such as IF MARRIED THEN, or IF SINGLE THEN. This construction will be explained in the discussion of conditional clauses later in this chapter.
