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

Handling Data Exceptions


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
praveenan

New User


Joined: 03 Dec 2007
Posts: 3
Location: India

PostPosted: Thu Jul 09, 2009 4:50 pm
Reply with quote

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

Moderator Emeritus


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

PostPosted: Thu Jul 09, 2009 10:05 pm
Reply with quote

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

New User


Joined: 03 Dec 2007
Posts: 3
Location: India

PostPosted: Tue Jul 14, 2009 11:17 am
Reply with quote

Thanks!. Now I have used 'verify' before using that field and it works now.
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: Tue Jul 14, 2009 7:40 pm
Reply with quote

Good to hear it is working - thanks for letting us know icon_smile.gif

d
Back to top
View user's profile Send private message
praveenan

New User


Joined: 03 Dec 2007
Posts: 3
Location: India

PostPosted: Wed Jul 15, 2009 10:59 am
Reply with quote

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
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 1
No new posts Store the data for fixed length COBOL Programming 1
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