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

Data Truncation Issue


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

New User


Joined: 01 Dec 2011
Posts: 2
Location: US

PostPosted: Fri Dec 02, 2011 1:57 am
Reply with quote

Hi ,

Can any one suggest me the corect way to do this

File field 1 (Data Type: S9(6)V99)
Screen field (Data Type: X(9))
WS variable field (Data Type: - - - - - 9.99)

I am having a data truncation error of 1 byte when Data is moved from file field 1 to Working storage which needs to be then moved to screen field
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: Fri Dec 02, 2011 2:02 am
Reply with quote

The V in PIC S9(7)V99 is an IMPLIED decimal point -- it does not really exist. You are moving a 9-byte data field to a numeric edited data field that has 8 numeric postiions (5 dashes which can be numeric digits, the 9 before the decimal point, and the 2 digits after the decimal point). If you move 9 digits to 8 digits, you're going to lose a digit.
Back to top
View user's profile Send private message
Jerry.Sein

New User


Joined: 01 Dec 2011
Posts: 2
Location: US

PostPosted: Fri Dec 02, 2011 2:24 am
Reply with quote

So should I update the receiving field to -----99.99. Will this help ?
i tried changing it to ZZZZZZ.ZZ .

If I do this it actually gets the amounts correctly without truncation ?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 02, 2011 2:59 am
Reply with quote

Hello and welcome to the forum,

Suggest you try a few experiments with different lengths and edit masks.

Keep in mind that the "v" is an implied decimal point and will align to the actual decimal point in edited output.

If any of these experiments give unexpected results, please post the field definitions and the output value generated.
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: Fri Dec 02, 2011 3:10 am
Reply with quote

Because the sending numeric field is signed, do you need the map data displayed with a prefixed or suffixed '-' or '+'?

Mr. 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: Fri Dec 02, 2011 5:20 am
Reply with quote

------9.99 or -----99.99 will work as long as your numbers are positive but NOT ZZZZZZ.ZZ since you only have six digits before the decimal point. Ideally, you should use -------9.99 or ------99.99 (7 digits before the decimal point plus one for the sign, along with the 2 after the decimal point). Note that the X(9) variable must be changed to X(10) [or X(11) to accommodate the decimal point and the sign] and your map must reflect the increased length as well.
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 Store the data for fixed length COBOL Programming 1
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top