88 Level Number - Single Value
88 Level Number - Single Value Example
Scenario - Declaring a condition name with single value using 88 level number.
Code -
----+----1----+----2----+----3----+----4----+----5----+
IDENTIFICATION DIVISION.
PROGRAM-ID. LEVEL88S.
AUTHOR. MTH.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-GENDER PIC X(01) VALUE "M".
* Condition name with a single value
88 WS-MALE VALUE "M".
88 WS-FEMALE VALUE "F".
PROCEDURE DIVISION.
IF WS-MALE
DISPLAY "Gender is Male"
ELSE
DISPLAY "Gender is Female"
END-IF.
STOP RUN.
Output -
Gender is Male
Explaining Example -
In the above example:
- WS-GENDER is declared as a single-byte alphanumeric variable. It has two condition names.
- WS-MALE and WS-FEMALE are single-value condition names. If WS-MALE (i.e., IF WS-GENDER EQUALS "M") is satisifed, "Gender is Male" will be displayed. Otherwise, "Gender is Female" will be displayed.