View previous topic :: View next topic
|
Author |
Message |
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
In cobol, if I define a variable as below:
Code: |
01 PIC S9(13)V9(2) COMP-3.
|
and I move data to it in subsequent step:
the value of A displays as below:
Code: |
----+---
----+---
----+---
-------
......&.
00001350
0000240C
|
and then, when I
the value of A displays as below:
Code: |
----+---
----+---
----+---
-------
.......*
00000135
0000024C
-------
******** |
My question is, how do I know the value stored in the output D/S is 12345 or 123.45, provided I do not know the definition in cobol program? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
If the receiving field were display, you'd see -
X'F1F2F3F4F5' (CL5'12345')
If it were a binary-fullword (4-bytes), you'd see -
X'00003039' (also expressed in decimal as F'12345')
And finally (as you've posted) signed packed decimal -
X'12345C' (only 3-bytes shown). Also expressed as PL3'12345'.
Only masked-fields, such as PIC ZZZ,ZZZ.99 have an explicit decimal point. All others have an implicit decimal point.
So, without a field definition, you would not know if a field has an implicit decimal point.
Mr. Bill |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
how do I know the value stored in the output D/S is 12345 or 123.45, provided I do not know the definition in cobol program? |
You will never know! amen |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
My question is, how do I know the value stored in the output D/S is 12345 or 123.45, provided I do not know the definition in cobol program?
|
The V in the PICTURE clause is an IMPLIED decimal point -- meaning it does not really exist, but that COBOL uses that spot for decimal alignment. If you cannot see the COBOL definition, you cannot know where the implied decimal point is (if there is one at all). |
|
Back to top |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
I fullly understood this, thank you, experts! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
follow on ...
Quote: |
Doubt on EBCDIC format of data.... |
the title of the question is also wrong ...
the data stored <in> the computer is not <in se> EBCDIC, ASCII, KLINGON, ...
is just a sequence of bits which is interpreted according to some convention
anyway PACKED data is NOT an EBCDIC <thing>
see the POP here
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9ZR003/CCONTENTS?SHELF=DZ9ZBK03&DN=SA22-7832-03&DT=20040504121320
the same concept (virtual/implied decimal point) applies also to BINARY data
You will never know until You see the program dealing with it (COBOL,ASSEMBLER,PL/I,KLINGONESE) |
|
Back to top |
|
|
|