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

comp1-comp2


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

New User


Joined: 27 Feb 2004
Posts: 18

PostPosted: Sat Jun 05, 2004 11:15 am
Reply with quote

Hi

In cobol comp1 and comp2 will take 1 word and 2 word respectivelly.
But i would like to know its internal representation.here is an exp

77 d1 comp1
77 d2 comp2

move 100 to d1,d2.

How much byte will take in both cases and i would like to know how it will work internally.

Thanx
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1210
Location: India

PostPosted: Sat Jun 05, 2004 5:40 pm
Reply with quote

Dear

COMP-1 takes 4 Bytes and the internal format is: +0.9( 8 ) E+99

COMP-2 occupies 8 Bytes and the internal format is: +0.9(17)E+99

So the value for:

01 D1 COMP-1 VALUE ZERO.
01 D2 COMP-2 VALUE ZERO.

MOVE 100 TO D1.
MOVE 100 TO D2.


is:

+0.1E+3 and +0.1E+3 respectively.
Back to top
View user's profile Send private message
nandini

New User


Joined: 27 Feb 2004
Posts: 18

PostPosted: Sun Jun 06, 2004 9:45 am
Reply with quote

Hi sir,


Thank You sir, I have some more doubt on it.I couldn't undestand the ' E ' in
+0.1E+3 and can u explain by moving different values in to comp1 and comp2. Also why we are not specifying any pic value . Suppose if we are moving a value more than 2 word what happend? Hope u will reply


Love
Nandini
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1210
Location: India

PostPosted: Sun Jun 06, 2004 10:18 am
Reply with quote

'E' is a Code Character like 9, X, A, P , V, S & G. It occupies 1 Byte.

E Means Exponentiation.

Take the value 12345

You can say this as: 0.12345 * 10 ** 5

Internally this is equivalent to +0.12345E5

You can not specify Picture clause for COMP-1, -2, INDEX & POINTER data items. Because there Data type, size & format of this items are pre-defined.
Back to top
View user's profile Send private message
nandini

New User


Joined: 27 Feb 2004
Posts: 18

PostPosted: Sun Jun 06, 2004 12:38 pm
Reply with quote

Hi sir
Thank You sir,

Sir, u specified 'E' is a Code Character like 9, X, A, P , V, S & G' Whether
this letters have any significats or u specified it just like other character.


thanks
love
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 Differnce between comp1 and comp3 Mainframe Interview Questions 3
No new posts Why we do not use PIC clause in COMP1... COBOL Programming 1
No new posts Moving COMP2 field to COMP3 COBOL Programming 1
No new posts COMP, COMP1, COMP2 & COMP3 in COBOL Mainframe Interview Questions 14
No new posts Pic in Comp1 and Comp2? COBOL Programming 1
Search our Forums:

Back to Top