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

Significance of value -252645136 while initializing


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

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Tue Aug 17, 2010 10:52 am
Reply with quote

Hi,

Can anyone let me know the significance of the value -252645136 which was holded by the sublevel variables(var1,var2 & var3) in the given structure when I to try initialize using the below statement

Move zeroes to groupvar1.

01 groupvar1.
05 var1 pic s9(9) comp.
05 var2 pic s9(9) comp.
05 var3 pic s9(9) comp.

If I use the statement INITIALIZE groupvar1. The variables(var1,var2 & var3) are having value as zero.
Back to top
View user's profile Send private message
Kurt Deininger

New User


Joined: 13 Jul 2010
Posts: 19
Location: Frankfurt/Germany

PostPosted: Tue Aug 17, 2010 11:07 am
Reply with quote

Hi murugan_mf,

The value -252645136, converted to hex, is F0F0F0F0, which in turn converted to EBCDIC is "0000". Field groupvar1 is a group item, which is treated like an X(12) alphanumeric field, therefore, the figurative constant ZERO is a string of EBCDIC zeroes.

Cheers. Kurt
Back to top
View user's profile Send private message
murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Tue Aug 17, 2010 11:43 am
Reply with quote

Kurt,

Thanks a lot!
Back to top
View user's profile Send private message
murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Tue Aug 17, 2010 12:23 pm
Reply with quote

Hi Kurt,

I have checked the hex value for -252645136 its having the value as below

-252645136
6FFFFFFFFF
0252645136

Can you please clarify, its contradicting what you have said earlier.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 17, 2010 1:20 pm
Reply with quote

murugan_mf,

what you have is the ebcdic representation of -252645136.
that is not the hex equivalent of -252645136.

Kurt made no contradicting statement.
although, he made the mistake of assuming you understood basic computer concepts.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Aug 17, 2010 3:52 pm
Reply with quote

Moving ZEROS to GROUPVAR1 (a group move), will cause the compiler to move X'F0F0F0F0F0F0F0F0F0F0F0F0'.

Moving LOW-VALUES to GROUPVAR1, will cause the compiler to move X'000000000000000000000000'.

The LOW-VALUES move is the same as moving ZEROS to each of the elementary COMP items which belong to the GROUP. In your example, each COMP elementary item is 4-Bytes long, sometimes referred to a a binary-fullword.

GROUP moves are always considered by the compiler to be ALPHANUMERIC.

So, ZEROS at a GROUP level and ZEROS at an ELEMENTARY level are different.

If the GROUP had (for example) 12 elementary items, defined as PIC 9(15) (Display-Numeric), then moving ZEROS to the GROUP would be correct.

Suggest a review of the MOVE statement in the applicable COBOL manual is in order.

Bill
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Aug 17, 2010 3:54 pm
Reply with quote

There is a link to manuals at the top of the page. Click on it, find the COBOL Language Reference manual for your version of COBOL, and read until you find out about the internal representation of numbers in COBOL. Convert your -252645136 value to hex and compare to the internal representation of your variables. Hopefully, you will begin to understand.
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 Initializing filler default value whe... COBOL Programming 6
No new posts VSAM Initializing causing Repro to ru... JCL & VSAM 4
No new posts what is the significance of REPLACE=N... JCL & VSAM 6
No new posts Significance of APOST and XREF in PARM JCL & VSAM 2
No new posts Content of variable before moving or ... COBOL Programming 10
Search our Forums:

Back to Top