Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to capture data exception abend?

 
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 Nov 01, 2012 6:25 pm    Post subject: How to capture data exception abend?
Reply with quote

In my program, i have below statment:
Code:
COMPUTE WK-TMP-NUM        =     FUNCTION NUMVAL(WK-NUM)
END-COMPUTE                                                 


and if illegal character exists in WK-NUM, program abended with data exception.

But what if I want to caputure this abend?

I mean, when error occurs when execute 'FUNCTION NUMVAL', I want to save some error message, like ' data exception occurred, please check the input data' into DB2 table, how can I do it?
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Nov 01, 2012 6:43 pm    Post subject:
Reply with quote

Hi dejunzhu,

You mean illegal characters are nothing but non-numeric data?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Nov 01, 2012 6:59 pm    Post subject: Reply to: How to capture data exception abend?
Reply with quote

what about doing a bit of research and manual reading Yourself

a simple google with cobol abend handling
( not too complicated I guess )

returned quite a few useful links

here is a cut and paste of the first page
Quote:
[PDF]
ibm Exploit Condition Handling in LE
www-01.ibm.com/support/docview.wss?uid=swg27016953&aid...File Format: PDF/Adobe Acrobat - Quick View
In this case, want to use RESUME using LE features rather than ABEND. – Want to write the code to handle errors in COBOL, not assembler. • Could also use ...
Abend handling
publib.boulder.ibm.com/infocenter/.../com.../t_hndlng_abend.htmlAbend handling. About this task. A program-level abend exit facility is provided in CICS® so that you can write exits of your own that can be given control during ...
Using Language Environment Abend-handling
publib.boulder.ibm.com/infocenter/cicsts/v2r3/.../dfhp3pr.htmIf TRAP(OFF) is specified, no error handling takes place; the abend proceeds. ... condition handler (other than in COBOL), you can use most CICS commands, ...
[PDF]
Got COBOL? Bet you didn't know you could do THIS in COBOL
proceedings.share.org/client_files/SHARE.../S8237TR124124.pdfFile Format: PDF/Adobe Acrobat - Quick View
Retrieving information about an ABEND with COBOL. – XML GENERATE ... Add condition handling to your application with no programming changes to the ...


odd that with such many results You felt the need to ask rather than purus the issue Yourself

the first link has also a code example
http://www-01.ibm.com/support/docview.wss?uid=swg27016953&aid=1
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Thu Nov 01, 2012 7:07 pm    Post subject: Reply to: How to capture data exception abend?
Reply with quote

What you think you want to do isn't necessarily the best thing.

Can you show a representative sample of your data you are sending to NUMVAL? NUMVAL, as you've noticed, blows up with bad data, but you can check for bad data before calling, then you don't need to get into the "LE Abend Handler" and all that goes with that.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Nov 01, 2012 9:04 pm    Post subject:
Reply with quote

Hello,

Quote:
and if illegal character exists in WK-NUM,
Correct the code that generates this value. . .

It should never be invalid when being used.

If there is no control over the creating code, make a decision on what should happen when the value is invalid (change to zero, terminate the process with an error, etc).
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Fri Nov 02, 2012 2:28 pm    Post subject:
Reply with quote

I tried to verify every byte of the input of 'FUNCTION NUMVAL(WK-NUM)', but since there might be sign character, which might be '+' or '-' contained in the front or in the end of the field, when I verify the field with 'IF WK-NUM IS NUMERIC', and if '+' or '-' exists in the field, WK-NUM will never be recognized as NUMERIC.

so, I want to perform FUNCTION NUMVAL directly without any pre-verification.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Nov 02, 2012 2:40 pm    Post subject: Reply to: How to capture data exception abend?
Reply with quote

Quote:
... without any pre-verification.


by doing anything without any [pre]verification
You will deserve all misfortunes in which You might incur icon_cool.gif

( and not only in the IT world )
if You had to go for a deep sea immersion would You check if the air cylinders are at full pressure ???
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Fri Nov 02, 2012 6:54 pm    Post subject:
Reply with quote

Hello,

Quote:
so, I want to perform FUNCTION NUMVAL directly without any pre-verification.
Utter nonsense . . . icon_evil.gif

You MUST use the system as it is designed and working, NOT as you would prefer it woked.

How in the world could "numval" be coded to handle everyone's perception of what is "valid"?

NUMVAL is excellent for data that is guaranteed (i.e. generated by code that Always works). For data from an unknown or questionable source, it must be completely validated before any use as a number.

Keep in mind that there are a few billion lines of code that address the very issue of validating numeric fields. Compared to all of the code ever written, NUMVAL is a rather new feature and is Not for every occasion.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Nov 02, 2012 7:03 pm    Post subject: Reply to: How to capture data exception abend?
Reply with quote

On top of that, the validation you seem to need from the little you have described is enormously simple.

To my mind it would be plain nuts, and much slower in terms of processing, and much more difficult to plan, and ever more difficult to maintain as you do it more often, to use this to trap abends from NUMVAL.

If you do not have leading space, use FUNCTION REVERSE to put it into a new field of the same size, then INSPECT to replace the by-now leading spaces. Use INSPECT to change one -/+ to zero, and ONE "." to zero. Test this field for being numeric. If so, use NUMVAL, else log it as an error.

In fact, your data, as you describe it, is so simple, you've no need of NUMVAL, but that is another story.
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 Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us