IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

use of COMP variables


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
brahmanandareddy

New User


Joined: 16 Dec 2004
Posts: 44
Location: Hyderabad

PostPosted: Fri Jan 20, 2006 2:35 am
Reply with quote

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
View user's profile Send private message
jon_s_rice

Active User


Joined: 24 Mar 2005
Posts: 102
Location: Douglasville, GA USA

PostPosted: Fri Jan 20, 2006 8:06 am
Reply with quote

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
View user's profile Send private message
bsriramulu
Warnings : 2

New User


Joined: 20 Jan 2006
Posts: 8

PostPosted: Tue Jan 24, 2006 10:48 am
Reply with quote

Hi ,
Any body pls give me reply urgent.

with cheers,
sriram.
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Tue Jan 24, 2006 11:15 am
Reply with quote

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
View user's profile Send private message
gowtham_1982
Warnings : 1

Active User


Joined: 02 Dec 2005
Posts: 109

PostPosted: Tue Jan 24, 2006 12:35 pm
Reply with quote

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
View user's profile Send private message
ksrujan

New User


Joined: 24 Jan 2006
Posts: 4

PostPosted: Wed Jan 25, 2006 11:49 am
Reply with quote

hai Brahma,

If you want to know more about COMP here is the link.
www.discinterchange.com/TechTalk_COBOL_comp_.html

Thanks,
Srujan
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts JCL with variables JCL & VSAM 1
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts JCL Variables JCL & VSAM 1
Search our Forums:

Back to Top