View previous topic :: View next topic
|
Author |
Message |
praveenan
New User
Joined: 03 Dec 2007 Posts: 3 Location: India
|
|
|
|
Hi,
Could someone please help on the below.
I have a variable PRICE declared as PIC '(4)9V.999'. When my program reads a value of '****.**' in place of price it abends. I have tried to handle this using ON Conversion and skip this error record with PRICE value '****.**'.
But instead of getting to ON Conversion block, my job abends with DATA EXCEPTION (ONCODE 8097). Now I want to know, how to handle this in a better way and skip the records that have any invalid value like '****.**'.
The program abends with DATA EXCEPTION while executing something like this:
IN.UNIT_PRICE = ROUND(REC.PRICE,2) * 100; |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
To avoid the data exception, you need to ensure the field contains a valid numeric value before moving it or using it in some calculation. |
|
Back to top |
|
|
praveenan
New User
Joined: 03 Dec 2007 Posts: 3 Location: India
|
|
|
|
Thanks!. Now I have used 'verify' before using that field and it works now. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thanks for letting us know
d |
|
Back to top |
|
|
praveenan
New User
Joined: 03 Dec 2007 Posts: 3 Location: India
|
|
|
|
Hi,
I still have a question regarding the use of ON CONVERSION.Is it mandatory that we need to correct the error record which gets to CONVERSION loop (say using ONCHAR or ONSOURCE). Can we not just try to skip the record when it enters ON CONVERSION?.
I wanted to skip the records whichever encounters CONVERSION error, by just setting some flags inside the CONVERSION block ,like below.
ON CONVERSION
BEGIN;
WRIT_IT=0;
ERR_CNT=0;
END;
But the error record is not skipped,instead the conversion error is thrown.Please could someone help me on this. |
|
Back to top |
|
|
|