View previous topic :: View next topic
|
Author |
Message |
mallik4u
New User
Joined: 17 Sep 2008 Posts: 75 Location: bangalore
|
|
|
|
Hi,
I have following doubt in 01 level variables declaration in COBOL program.
for example:
01 ws-file-status 9(02).
I heard that though the variable is asking for 2 chars, still mainframe will allocate 1 FULL WORD since the variable is declared as 01 LEVEL. Could some let me know whether this is correct or not?
Thanks,
Mallik |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
There is a link to manuals at the top of this page. If you click on it, and find the COBOL Language Reference manual, section 5.3.16 has this:
Quote: |
In the working-storage section, the compiler aligns all level-01 entries on a doubleword boundary. |
So the answer is, you are wrong. The compiler aligns 01 levels on the double word, meaning a 2-byte 01 level actually uses 8 bytes of storage, not 4.
However, the question comes up as to WHY you are concerned? Since the COBOL WORKING-STORAGE can be over 130 million bytes, you would need more 01 levels than you want to key before you have any problem. |
|
Back to top |
|
|
mallik4u
New User
Joined: 17 Sep 2008 Posts: 75 Location: bangalore
|
|
|
|
Thank you very much Robert for the quick reply. |
|
Back to top |
|
|
|