View previous topic :: View next topic
|
Author |
Message |
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
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 |
|
|
Kurt Deininger
New User
Joined: 13 Jul 2010 Posts: 19 Location: Frankfurt/Germany
|
|
|
|
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 |
|
|
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
Kurt,
Thanks a lot! |
|
Back to top |
|
|
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|