TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

COBOL - Level Numbers

Data Items - Level Numbers:

Levels 01-49 : Data Structuring Items
  • Levels 01-49 are used to create hierarchical data items. The highest level item in the hierarchy will always be the 01 item and every item contains the items beneath it with higher level numbers (up until the next item with a lower level number or the end of the section or division). Items which contain other data items are called group items and those which don't contain other data items are called elementary items.

  • Although all of the numbers from 01-49 are available, by convention levels 01, 05, 10, 15, 20, 25, etc. are used.


In this example, there are three group level items, A, B, and E and there are four elementary items, C, D, F, and G. The sizes of the elementary items are determined by their picture clauses.

See picture clauses below for more information on this. The sizes of the group items are determined by the sizes of the elementary items below them. Since B consists of the elementary items C (20 characters) and D (10 characters), B is 30 characters in length. Since E consists of the elementary items F (5 characters) and G (10 characters), E is 15 characters in length. Since A consists of the sub-groups B (30 characters) and E (15 characters), A is 45 characters in length.

Level 66 : Renaming Items

Sometimes it is desirable to group items from two separate groups into a group of their own. Say we want to create a new group of items consisting of items D and F, but we don't want to interfere with these data items also belonging to groups B and E.


In this example, we could add a line after the last line, to create a new group from items D and F. To do this we would code:

image missing

Following is the last line of the 01 level item.

Level 77 : Stand Alone Items
  • Level 77 items have been designated for deletion from the COBOL language and have been included here only in case you encounter one in an existing program. Level 77 items should not be coded in new programs.

  • A level 77 item is used to define an item which is not to be subdivided any further. You can accomplish the same thing with a level 01 item, just don't subdivide it

Level 88 : Condition Name Items

A level 88 item is used to give a name to a condition. Using a condition name has two primary benefits:

  • It allows a descriptive name to be assigned to what otherwise might not be an obvious reason for a test.
  • If a condition that is subject to change due to condition beyond the control of the programmer and that condition is tested multiple places in the PROCEDURE DIVISION, using the condition name in the PROCEDURE DIVISION instead of the actual condition allows the programmer maintaining the program to change the values defining the condition in only one place in the DATA DIVISION rather than having to hunt down all of the individual occurrences in the PROCEDURE DIVISION.

To test for a company doing business in California, without the 88-level item, you would have to code:

It would not be apparent to the person reading the code what condition you were testing for. With the 88 in place, you could code the test like this:

Anybody reading the code could tell what condition you were testing for and if the check was done several times throughout the PROCEDURE DIVISION and the list of companies doing business in California changes, it is only necessary to change the list of values associated with the 88-level item.

While the data name associated with an 88-level item may have any value, the 88-level item itself can only have one of two values, true or false. The item is true if the data item immediately above the 88 has any of the values associated with the 88-item, otherwise it is false.

88- level items may be associated with either group or elementary items.

If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal