View previous topic :: View next topic
|
Author |
Message |
brahmanandareddy
New User
Joined: 16 Dec 2004 Posts: 44 Location: Hyderabad
|
|
|
|
Hi,
We know that COMP-3 variables are better than COMP variables as it requires less storage. But we also colde COMP variables in COBOL programs. Can anybody tell me why do we go for COMP variables. Is the storage only criterion or there any differences?
Thank you,
Brahma |
|
Back to top |
|
|
jon_s_rice
Active User
Joined: 24 Mar 2005 Posts: 102 Location: Douglasville, GA USA
|
|
|
|
COMP variables take less sapace since they are binary variables. Comp variables are more effcient as count variables and as a subscript. |
|
Back to top |
|
|
bsriramulu Warnings : 2 New User
Joined: 20 Jan 2006 Posts: 8
|
|
|
|
Hi ,
Any body pls give me reply urgent.
with cheers,
sriram. |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Hi,
s9(4)comp is small integer ,so two words equal to 8 bytes. Totally it will occupy 2 bytes(4 words).here in s9(4) comp-3 as one word is equal to 1/2 byte.4 words equal to 2 bytes and sign will occupy 1/2 bytes totally it will occupy 3 bytes |
|
Back to top |
|
|
gowtham_1982 Warnings : 1 Active User
Joined: 02 Dec 2005 Posts: 109
|
|
|
|
brahmanandareddy wrote: |
Hi,
We know that COMP-3 variables are better than COMP variables as it requires less storage. But we also colde COMP variables in COBOL programs. Can anybody tell me why do we go for COMP variables. Is the storage only criterion or there any differences?
Thank you,
Brahma |
hai Brahma,
we go for differnet usage clauses depending on the requirement. Basically COMP variables are used when we need to store subscripts. They serve a good purpose as count variables.
COMP-3 variables are used to reduce the storage as some have said in the posts. Note the major difference lies is the storage of sign. COMP variables do not have a separate storage for sign wherein COMP-3 variables have. Even if you've not specified the SIGN CLAUSE in COMP-3 variable, the right most half nibble is dedicated for sign storage. In case of COMP varibales, the sign is stored embedded with no separate storage.
corrections welcomed.....
gowtham |
|
Back to top |
|
|
ksrujan
New User
Joined: 24 Jan 2006 Posts: 4
|
|
Back to top |
|
|
|