77 Level Number Uses, significance:77 is a special Level number in COBOL which is used to declare the Individual Elementary data items. Of course, Individual elementary data items can be declared using 01 level but 77 declared fields does not allow any sub ordinate data field declarations. These have been very useful in earlier versions of COBOL where there was a difference in storing and processing of the 77 and 01 level items. But with the latest version of COBOL, both 01 and 77 declared fields are working similarly so 77 items does not have much significance even though they are in use.
77 Level number was pivotal in older days as the execution speed of object code was a major factor. CPU Time was also a major issue in older days. They used to assign faster access registers to most frequently used variables and the 77 level numbers are designed to assign it to faster access registers. So the frequently used variables used to be declared with 77 level number.
In these days it has no significance but even few programmers use this special Level Number 77 to declare some special kind of fields where they do not want any sub ordinate fields to be declared. Also in some organisations there are being used as part of the standards set.
77 WS-TOTAL-NUM PIC 9999.
It is not restricted for numeric, it can be used for other pictures as well.
77 WA-HEADING PIC X(10).
- Declaration should start in Area-A.
- No sub items are allowed.
- It should not be a part of any other item.
- Can be used for all types of data items.