Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 2504
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: 10375
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: 8201
Location: Dubuque, Iowa, 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: 10375
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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Conversion of UTF-8 to EBCDIC muralikrishnan_new COBOL Programming 1 Tue Nov 21, 2017 5:33 pm
No new posts Can EDCICONV convert EBCDIC to ASCII... natt.sut IBM Tools 3 Fri Nov 17, 2017 8:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us