Levels Numbers in COBOL
level number are play very important role in declaration of the variables in the COBOL.
level number are describe the hierarchy of data in the COBOL.
level number available are 01 to 49 , 66, 77 and 88.
level number are two types based on the usage.
General purpose level number.
Special purpose level number.
General purpose level number:
In this level number are start with low number 01 and maximum number is 49.
Based on this level number, the data items/variables are divided different categories.
1.Individual data item.
2.Group data item.
3.Elementary data item.
Individual data item:
it is a data item which will be the only one variable declaration.
it has picture clause and no sub items.
individual data item are unique number in the program.
example:
01 WS-NAME PIC A(10).
02 WS-CLASS PIC 9(02).
49 WS-RANK PIC 9(01).
Note : there is no elementary data items under it and level number from 01 to 49.
Group data item:
it is a data item which will be the first variable declared.
group data item don't have picture clause and it has elementary data item.
example:
01 BILL-PRINT-FIXED-AREA. -----------------> group data item.
15 BPF-INV-NR PIC X(15). ---------------------- elementary data item
15 BPF-INV-DT PIC X(10). --------------------- elementary data item
15 BPF-INV-TM PIC X(4). --------------------- elementary data item.
note: group data item level number start from 01 to 48.
Elementary data item:
it is a part of group data item and it has a picture clause.
elementary data item level number start from 02 to 49.
in above example under group data item are elementary data item.
Special purpose level number:
special purpose level number are below:
66 -----> used for Rename clause.
77------> individual elementary data item.
88-------> used for condition names
88 level number:
It used as like if condition.
For example.
10 DAYS PIC X(10).
88 MONDAY VALUE '00'.
88 TUESDAY VALUE '10'.
In this above example "DAYS" expected the data from end user and it's check with below conditions which is by 88 level number.
77 level number:
Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.
level number are describe the hierarchy of data in the COBOL.
level number available are 01 to 49 , 66, 77 and 88.
level number are two types based on the usage.
General purpose level number.
Special purpose level number.
General purpose level number:
In this level number are start with low number 01 and maximum number is 49.
Based on this level number, the data items/variables are divided different categories.
1.Individual data item.
2.Group data item.
3.Elementary data item.
Individual data item:
it is a data item which will be the only one variable declaration.
it has picture clause and no sub items.
individual data item are unique number in the program.
example:
01 WS-NAME PIC A(10).
02 WS-CLASS PIC 9(02).
49 WS-RANK PIC 9(01).
Note : there is no elementary data items under it and level number from 01 to 49.
Group data item:
it is a data item which will be the first variable declared.
group data item don't have picture clause and it has elementary data item.
example:
01 BILL-PRINT-FIXED-AREA. -----------------> group data item.
15 BPF-INV-NR PIC X(15). ---------------------- elementary data item
15 BPF-INV-DT PIC X(10). --------------------- elementary data item
15 BPF-INV-TM PIC X(4). --------------------- elementary data item.
note: group data item level number start from 01 to 48.
Elementary data item:
it is a part of group data item and it has a picture clause.
elementary data item level number start from 02 to 49.
in above example under group data item are elementary data item.
Special purpose level number:
special purpose level number are below:
66 -----> used for Rename clause.
77------> individual elementary data item.
88-------> used for condition names
88 level number:
It used as like if condition.
For example.
10 DAYS PIC X(10).
88 MONDAY VALUE '00'.
88 TUESDAY VALUE '10'.
In this above example "DAYS" expected the data from end user and it's check with below conditions which is by 88 level number.
77 level number:
Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.
What is the difference between level 77 and 01? And which is more efficient?
Level 77 can be used to describe independent elementary items in the Working Storage or Linkage Sections. Level 77 cannot use Redefines.
Level 01 can be used to describe both elementary and group items. Any item described in Level 01, the system is putting on Double-Word boundary and inserts slack bytes if necessary
Comments
Post a Comment