Page 2 of 2

Re: numberic data being truncated

PostPosted: Thu Nov 04, 2010 11:56 am
by littlechicken
I would display the input and the result field then you will see the exact field where it all goes missing and also add a record count and display that also at the same display.

this would make debugging easier for using iebeyeball the worlds best debugging tool easier to use rather than the really unpopular utility iebguess.

Re: numberic data being truncated

PostPosted: Thu Nov 04, 2010 9:47 pm
by nicole
Hi again,

OK, it seems the records are getting truncated. When I try to change the WS-DOLLARS PIC 9(3) to PIC S9(7)V99 I get a ABEND SOC7. I think it has to do with maybe how the records are unstringed.

01 WS-DOLLARS PIC S9(7)V99.
01 WS-TEMP-CENTS PIC 99.
01 WS-CENTS REDEFINES WS-TEMP-CENTS
PIC V99.

01 WS-TEMP-AMOUNT PIC 9(3)V99.

When I use a display this is what is given: 06385 when it's suppose to be 106385

I think the problem lies here:
UNSTRING COIN-IN-REC
DELIMITED BY
ALL '.'
INTO WS-DOLLARS
WITH POINTER
CTR-1
UNSTRING COIN-IN-REC
DELIMITED BY
ALL '"'
INTO WS-TEMP-CENTS
WITH POINTER
CTR-1
ADD WS-CENTS WS-DOLLARS
GIVING WS-TEMP-AMOUNT

Still not sure why I'm not allowed to change that temp amount to a value that can handle the field. Let me know if you have any ideas. Thanks in advance.

Re: numberic data being truncated

PostPosted: Thu Nov 04, 2010 9:57 pm
by Robert Sample
Changing WS-DOLLARS is a start -- but your code
ADD WS-CENTS WS-DOLLARS
GIVING WS-TEMP-AMOUNT
means anything over 1000 in WS-DOLLARS will be truncated based on
01 WS-TEMP-AMOUNT PIC 9(3)V99.

Re: numberic data being truncated

PostPosted: Thu Nov 04, 2010 10:05 pm
by nicole
Yes I understand that, but everytime I change it I get that ABEND SOC7: The system detected a data exception.
I still can't understand it, why can't I change the pic to a larger amount to accomodate the incoming data. Maybe your right Robert, I shouldn't be a programmer.

Re: numberic data being truncated

PostPosted: Thu Nov 04, 2010 10:16 pm
by Robert Sample
I could see a S0C7 if you changed WS-DOLLARS, but not if you change WS-TEMP-AMOUNT (which is what I suggested you change). The UNSTRING command doesn't really make sense the way you've used it -- it is rare for input files not to be defined with fixed formats, so UNSTRING would not be needed to manipulate the data. Based on what you've got, I would try
01  WS-DOLLARS      PIC S9(07).
01  WS-DOLLARS-CHAR PIC X(07).
.
.
.
UNSTRING COIN-IN-REC
DELIMITED BY
ALL '.'
INTO WS-DOLLARS-CHAR
WITH POINTER
CTR-1 
MOVE FUNCTION NUMVAL (WS-DOLLARS-CHAR) TO WS-DOLLARS.
and leave the rest of the code as is.

Re: numberic data being truncated

PostPosted: Thu Nov 25, 2010 1:17 am
by nicole
Hi there,

Sorry for the long wait for a reply from me, but I finally figured it out. It's so simple it makes me look stupid, but live and learn. I have to change the WS-DOLLARS PIC s9(3) to PIC s9(4) and the WS-TEMP-AMOUNT PIC 9(3)v99 to PIC 9(7) v99. I realized I was trying to change to many things at once. So I left program alone for a few days and when I went back to it, I could see clearly what needed to be done. Thanks for everyone's help.

Re: numberic data being truncated

PostPosted: Thu Nov 25, 2010 3:10 am
by dick scherrer
Good to hear it is working - thank you for letting us know :)

d

Re: numberic data being truncated

PostPosted: Thu Nov 25, 2010 10:33 am
by littlechicken
welldone

display command is your friend :) in batch.