Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 5: Data Division


CONDITION NAME (Level 88)

  • Sometimes we have to perform check in programs like whether gender is male or female, need to decide and check grade based on range of score, in such situation we can declare the condition name data items
  • A condition-name is special type of data items that is associated to a value or set of values and we can use these data items directly in condition checking (in IF, EVALUATE etc.)
  • For example,

    01 EMPLOYEE. 05 EMP-GENDER PIC X(01). 88 MALE VALUE 'M'. 88 FEMALE VALUE 'F'. 88 VALID-GENDER VALUE 'M' 'F'. 05 EMP-GRADE PIC 9(03). 88 A-GRADE VALUE 070 THRU 100. 88 B-GRADE VALUE 040 THRU 069. 88 C-GRADE VALUE 000 THRU 039.

  • In above example, three condition names have been defined under EMP-GENDER conditional variable, and three condition names have been defined under EMP-GRADE conditional variable. Conditional variable EMP-GENDER at any point of time can have either value ‘M’ or ‘F’. Similarly EMP-GRADE can have value between ‘000’ and ‘100’ and base on this value either of A-GRADE, B-GRADE, C-GRADE is set to true. Below is how we can use it in COBOL program.
  • A conditional name (example:- MALE) must always be associated with conditional variable(EMP-GENDER). A condition name cannot be defined independently. A condition name is specified with value or set of values. The condition name becomes true whenever the conditional variable contains any of these values Otherwise, the condition name is set to false
  • Basic syntax:-
    Syntax format 1:-
    88 condition-name VALUE literal|figurative constant
    Syntax format 2:-
    88 condition-name VALUE literal-1, literal-2, literal-3….
    Syntax format 1:-
    88 condition-name VALUE literal-1 THRU|THROUGH literal-n.
  • Important rules to be considered while using condition names:-
    • It must be declared at special level number 88.
    • The level number must begin in Margin A or any position after it. Condition name must begin from Margin B or any position after it.
    • Normal data name naming rules also apply to condition name
    • If condition name with same name is declared under multiple condition variables, the condition name must be qualified by the name of its conditional variable
    • VALUE clause between condition name and conditional variable must not conflict
    • When the THRU/THROUGH phrase is used, literal-1 must be less than literal-n
    • A conditional variable can be an elementary or group data item. However it cannot be 66 level item, another condition name, group containing JUSTIFY clause, declared with SYNC clause or USAGE clause other than DISPLAY






© copyright mainframebug.com
Privacy Policy