Levels Numbers in COBOL


     1.     What are the different levels available in COBOL?
Level Numbers available are     01-49, 66, 77, 88
01-49      Group or elementary items
66          Renames clause
77          Independent elementary      data items
88          Condition names
     2.     What is 77 level used for?
Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.
     3.     What is 88 level used for?
88 level is used for condition names.
The level 88 in the Data Division can be used to give condition names to the values that a field contains. A condition name entry specifies either a single value or a set of values for the condityional variable. When this level is specified you can use the condition name instead of is =equal to in the IF statement. Condition name should be specified under Level 88 immediately following the field description.

    88 SINGLE     VALUE  “Y”.
    88 MARRIED   VALUE  ‘N’.
01 WS-REPLY               PIC X.
    88 REPLY-N0  VALUE “N”.
01 WS-MARKS             PIC 999.
    88  PASSED  
          VALUE 40 THRU 100.
    88  FAILED    
          VALUE 0 THRU 39.
     4.     What are level 66 used for?
For RENAMES clause.
     5.     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
     6.     How many different level numbers can be used in COBOL to describe a record?
     7.     Give some advantages of REDEFINES clause.
1.You can REDEFINE a Variable from one PI1CTURE class to another PICTURE class by using the same memory location. Multiple REDEFINES of same area possible
2. By REDEFINES we can INITIALISE the variable in WORKING-STORAGE Section itself.
3. We can REDEFINE a Single Variable into so many sub-variables. (This facility is very useful in solving Y2000 Problem.)

<Level>   <DataName1>  REDEFINES <DataName2>


01 Sales-Record.
     02 Sales-Type                      Pic X.
     02 Sales-By-Unit.
                 03 Qty                        Pic 9(4).
                 03 Unit-Price            Pic 9(8)V99.
     02 Total-Sales  REDEFINES Sales-By-Unit.
                 03 Amount                Pic 9(10)V99.
                 03 Filler                      Pic X(2).

     8.     Can I redefine an X (100) field with a field of X (200)?
Redefines just cause both fields to start at the same location. For example:
01 WS-TOP PIC X (1)

If you MOVE ‘12’ to WS-TOP-RED,
DISPLAY WS-TOP will show 1 while
DISPLAY WS-TOP-RED will show 12.

     9.     Can I redefine an X (200) field with a field of X (100)?


Computers TopOfBlogs Technology Blogs Mainframe interview question and answers,mainframe jobs,cobol,vsam,jcl,cics,db2,rdbms,mvs,tso,ispf,ibm,hcl,tcs,cts,wibro Blog Directory