88 Level Number
88 Level Number Example
Scenario - Condition names declaration (all formats) using 88 level number.
Code -
----+----1----+----2----+----3----+----4----+----5----+
IDENTIFICATION DIVISION.
PROGRAM-ID. LEVEL88S.
AUTHOR. MTH.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-ALPHABET PIC X(01).
* Condition names with single values
88 ALPHABET-A VALUE "A".
88 ALPHABET-S VALUE "S".
* Condition names with multiple values
88 VALID-ALPHABET VALUE "A" THROUGH "Z".
88 VOWELS VALUE "A" "E" "I" "O" "U".
* Condition names with range of values
88 CONSONANTS VALUE "B" THRU "D"
"F" THRU "H"
"J" THRU "N"
"P" THRU "T"
"V" THRU "Z".
PROCEDURE DIVISION.
SET ALPHABET-A TO TRUE.
IF VOWELS
DISPLAY "ALPHABET IS VOWEL: " WS-ALPHABET
END-IF.
SET ALPHABET-S TO TRUE.
IF CONSONANTS
DISPLAY "ALPHABET IS CONSONENT: " WS-ALPHABET
END-IF.
STOP RUN.
Output -
ALPHABET IS VOWEL: A ALPHABET IS CONSONENT: S
Explaining Example -
In the above example:
- WS-ALPHABET is declared as a single-byte alphanumeric variable. It has five condition names.
- ALPHABET-A and ALPHABET-S are single-value condition names. VOWELS is a multiple-value condition name. VALID-ALPHABET CONSONANTS is a condition name with a set of values.