Page 1 of 1

What is the difference between 77 and 01?

Posted: Fri Jun 21, 2013 11:10 pm
by Anil
Hi.

Can anyone please give me a reply advantage of 01 single item than 77 declaration?

Thanks,
Anil

Re: What is the difference between 77 and 01?

Posted: Sun Jun 23, 2013 11:50 am
by Akshypal
As far as I know, 01 is a group level item and can be elementary, while 77-level only elementary.

Re: What is the difference between 77 and 01?

Posted: Fri Aug 09, 2013 6:45 pm
by Anuj Dhawan
Akshypal is correct. As he said, 77 level can represent only elementary data, in other words, the element at level-77 cannot be subdivided while 01 can be.

On the other hand, both these levels should begin in area A and must be followed by a seperator period; or by a space followed by its associated data name, filler or appropriate data description clause.

Level-77 is bit old fashioned. I've used and seen other using the 01 level mostly. Some shops using panavlet still use 77 for "special purpose Panvelet varaibles". Also, on mainfames, if you combine the elementary items within one 01 level, you don't waste slack-bytes memory (though I think this depends on the compiler you're using but I'm not sure - I've not verified it yet). And what are slack-bytes, well, that seems beyond the scope of this topic.

Hope this helps.

Re: What is the difference between 77 and 01?

Posted: Wed Aug 14, 2013 8:16 am
by Anil
Thanks Anuj.

Re: What is the difference between 77 and 01?

Posted: Wed Aug 14, 2013 5:25 pm
by Robert Sample
I thought 77 might not be aligned but a test indicates that both 77 and 01 levels align on the double-word boundary.

Slack byts can be generated in an 01 if the SYNC clause is used to synchronize physical memory and data items (such as COMP or COMP-5 variables).

Re: What is the difference between 77 and 01?

Posted: Thu Sep 05, 2013 11:23 pm
by Anil
Thanks Anuj & Robert.

But are slack bytes still needed/generated?

Re: What is the difference between 77 and 01?

Posted: Fri Sep 06, 2013 12:53 am
by Robert Sample
The Enterprise COBOL Language Reference manual version 5.1, which has a 2013 copyright date, talks about slack bytes and their use with SYNC data. So yes, slack bytes are still generated and needed in COBOL programs.

Re: What is the difference between 77 and 01?

Posted: Fri Sep 06, 2013 10:23 am
by Anil
Thanks Robert. I looked at this: http://pic.dhe.ibm.com/infocenter/ratde ... ddesbb.htm

And got a question if slack-bytes were the "requirement" S/360 and propagated to current hardware? I'm sorry if my question sounds confusing, however, I'm also trying to understand if to have SYNC is hardware requirement or necessity of software?

Re: What is the difference between 77 and 01?

Posted: Fri Sep 06, 2013 3:10 pm
by Robert Sample
SYNC has never been a hardware requirement. However, if a 4-byte area of memory (PIC S9(09) COMP for example) needs to be loaded into a register (for arithmetic, perhaps), SYNC makes the task much easier -- a single Assembler instruction. The compiler will do the load whether or not SYNC is used but the generated code will be faster with SYNC.

Re: What is the difference between 77 and 01?

Posted: Fri Sep 06, 2013 4:55 pm
by William Collins
These days 77s and 01s are the same, apart from the elementary-only nature of the 77.

Previously, 77s were unalighed, and would allow more efficient use of storage for small fields, but one the 1MB limit on WORKING-STORAGE was removed, it no longer matters. Certainly Enterprise COBOL has 77s on a double-word boundary, like an 01. They used to have to be the first things in the WORKING-STORAGE/LINKAGE, but now they can go anwhere (because their characteristics have changed).

Unless something you are interfacing to requires SYNC, don't use it.

I've never seen different code generated for using/not using SYNC, so with modern machines/compilers you won't see different code generated.

On less mordern machines than I ever used, it would make a difference. In Assembler a Load Halfword when not alighned (on that old machine) would cause a "Specification Exception". The COBOL compiler was aware of this, so would generate an MVC to an alighed area in Temporary Storage, and then use the Temporary Storage field (and do the reverse process if the field was the target of an instruction which could change its value).

I've never seen performance differences, although people will tell you that down in the processing of the microcode (something you have no control over) there are differences, but if I can't see them, I don't worry about them.

Re: What is the difference between 77 and 01?

Posted: Sun Oct 13, 2013 5:49 pm
by Anil
Thanks for excellent explanation William.

I always wanted to learn how to see what code is generated under the cover but was not sure how to do that - do you think there can be some manual or a link around for such a thing, if yes, that will be of great help.

Re: What is the difference between 77 and 01?

Posted: Mon Oct 14, 2013 2:23 pm
by William Collins
All the compiler options are documented in the Programming Guide (assuming you are on a Mainframe) and the generated code has an example and is discussed there.

If you are not on a Mainframe, what COBOL compiler are you using?

Re: What is the difference between 77 and 01?

Posted: Mon Oct 14, 2013 8:00 pm
by Anuj Dhawan
Hi William,

That's really a great explanation - Thanks for being on this board, much appreciate your contribution... :)

Regards,