What is the difference between 77 and 01?
What is the difference between 77 and 01?
Hi.
Can anyone please give me a reply advantage of 01 single item than 77 declaration?
Thanks,
Anil
Can anyone please give me a reply advantage of 01 single item than 77 declaration?
Thanks,
Anil
Thanks,
Anil
Anil
Re: What is the difference between 77 and 01?
As far as I know, 01 is a group level item and can be elementary, while 77-level only elementary.
- Anuj Dhawan
- Founder
- Posts: 2802
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: What is the difference between 77 and 01?
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.
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.
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
- Robert Sample
- Global Moderator
- Posts: 1895
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: What is the difference between 77 and 01?
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).
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?
Thanks Anuj & Robert.
But are slack bytes still needed/generated?
But are slack bytes still needed/generated?
Thanks,
Anil
Anil
- Robert Sample
- Global Moderator
- Posts: 1895
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: What is the difference between 77 and 01?
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?
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?
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?
Thanks,
Anil
Anil
- Robert Sample
- Global Moderator
- Posts: 1895
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: What is the difference between 77 and 01?
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.
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: What is the difference between 77 and 01?
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.
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?
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.
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.
Thanks,
Anil
Anil
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: What is the difference between 77 and 01?
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?
If you are not on a Mainframe, what COBOL compiler are you using?
- Anuj Dhawan
- Founder
- Posts: 2802
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: What is the difference between 77 and 01?
Hi William,
That's really a great explanation - Thanks for being on this board, much appreciate your contribution...
Regards,
That's really a great explanation - Thanks for being on this board, much appreciate your contribution...
Regards,
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute