Handle Abend for intrensic functions



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Handle Abend for intrensic functions

Postby cvvishu » Wed Mar 08, 2017 5:26 pm

Hi ,
Is there a way to avoid hard termination of the program in case of a failure in cobol intrinsic function.

Example , i am trying to use NUMVAL function to validate the given PIC (X) field and move it to a numeric field . But if the given data is alphanumeric , i do not want my program to amend , rather i need to move a default value and continue with my next record. Is this achievable ?
cvvishu
 
Posts: 3
Joined: Wed Jul 13, 2016 9:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Handle Abend for intrensic functions

Postby Robert Sample » Wed Mar 08, 2017 9:09 pm

There is nothing in COBOL to do what you want. You might be able to achieve this through the LE interface, but you'll have to do the research to determine whether or not it can.

You might find it easier to scan the variable to pass to NUMVAL, looking for any invalid characters before using NUMVAL (the ease of this approach would depend upon how complex your NUMVAL variable gets).
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Handle Abend for intrensic functions

Postby BillyBoyo » Wed Mar 08, 2017 9:15 pm

Post some representative examples of what you want to convert. NUMVAL/NUMVAL-C aren't much use unless your data is good.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Handle Abend for intrensic functions

Postby Terry Heinze » Thu Mar 09, 2017 8:10 pm

Many, if not all, of COBOL's intrinsic functions do not validate input.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post