What is the difference between 01 and 77 levels

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
nareshmdk
Member
Posts: 6
Joined: Wed Dec 29, 2010 2:31 pm

What is the difference between 01 and 77 levels

Post by nareshmdk » Wed Dec 29, 2010 2:48 pm

Hi,
By using the 01 level we can define the variables as elementary and group. so what is the only use of 77.



thanks&regards
Naresh D

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Dec 29, 2010 3:03 pm

by definition a 01-level is a group-item
by definition a 77-level is an elementary item.

both are mapped on mod4 (or mod8) addresses - i forget which.
in the old days, certain instructions, as well as parameters for services that were CALLed,
required that variables be on mod4 or mod8 boundries.
This is no-longer true for COBOL
(if the bounding is necessary, the compiler will map a temporary field for the CALL)

a problem with using 77-levels is that unless the variable is a double word,
there will be unused memory between the 77-lvl definitions.

There really is no reason to use 77-levels anymore.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

nareshmdk
Member
Posts: 6
Joined: Wed Dec 29, 2010 2:31 pm

Post by nareshmdk » Wed Dec 29, 2010 3:56 pm

Hi Dick,

Can u expln the unused memory b/w 77 levels
Thanks&Regards
Naresh D

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Dec 29, 2010 5:16 pm

a lvl-77 is addressed at a mod4
(or mod8 - i forget and am unwilling to look at a listing to find out)

let us say it is mod4.

Code: Select all

77 flag1 pic x(01).   address 0000
77 flag2 pic x(01).   address 0004
77 flag3 pic x(01).   address 0008
that means address 0001 thru 0003 and 0005 thru 0007 are unused.

where as:

Code: Select all

01  flags.                    address 0000
     02 flag1 pic x(01).      address 0000
     02 flag2 pic x(01).      address 0001
     02 flag3 pic x(01).      address 0002
there are no unsued memory bytes in the above

if the addressing is allocated at mod8 (which i think it is)
there would be an additional 4 bytes between the lvl-77's
that would not be used.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

nareshmdk
Member
Posts: 6
Joined: Wed Dec 29, 2010 2:31 pm

Post by nareshmdk » Thu Dec 30, 2010 9:23 am

Thank u dick.
Thanks&Regards
Naresh D

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others