Module 5: Data Division
LEVEL 77
- It is used to declare independent data items. Data item declared at 77 level cannot be further sub-divided
- Level 77 is a special level number in COBOL which is used to declare independent data items; they are not subdivisions of other items and are not subdivided themselves.
- Level 77 data items can be defined only in WORKING-STORAGE, LOCAL-STORAGE and LINKAGE section
- It is true that using 01 level also we can define elementary data items but 01 level also allows to define subordinates entries thus 01 level can also be used as group data item
- In earlier days there were differences in storage and processing of level 77 and level 01 elementary items.
- In older days, due to limited advancement in hardware system, CPU time was major factor. That time they used to assign faster register to the frequently used variables and thus level 77 was introduced to declare most frequently used items. This way, when we declare most frequently used items at 77 level, it was helping in increasing the program efficiency.
- But with latest COBOL versions and lot of advancements in hardware there remains no much differences in how these both level works in terms of storage and processing.
- Still many programmers prefers to declare elements at level 77 such as COUNT, TOTAL that are often involved in calculation. In some organizations, these items are also being used as part of standard.
- Examples:-
77 WS-COUNT PIC 9(03). 77 WS-TOTAL PIC 9(10). 77 WS-HEADER PIC X(100).
- Important rules to be considered while using level 77:-
- Declaration must start from Margin A
- It cannot be subdivided into other data items
- Cannot be used in FILE SECTION.
- It should not be part of any group item
- Any data types can be used.