Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Doubt on EBCDIC format of data....

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu Oct 27, 2011 7:51 am    Post subject: Doubt on EBCDIC format of data....
Reply with quote

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:
Code:

move 12345 to A.

the value of A displays as below:

Code:

----+---
----+---
----+---
 -------
......&.
00001350
0000240C


and then, when I
Code:

move 123.45 to A

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

Bill O'Boyle

CICS Moderator


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

PostPosted: Thu Oct 27, 2011 8:30 am    Post subject: Reply to: Doubt on EBCDIC format of data....
Reply with quote

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Thu Oct 27, 2011 8:31 am    Post subject: Reply to: Doubt on EBCDIC format of data....
Reply with quote

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

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Thu Oct 27, 2011 9:57 am    Post subject:
Reply with quote

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

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu Oct 27, 2011 10:08 am    Post subject:
Reply with quote

I fullly understood this, thank you, experts!
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Thu Oct 27, 2011 10:10 am    Post subject: Reply to: Doubt on EBCDIC format of data....
Reply with quote

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
http://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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us