We help IT Professionals succeed at work.

rpgle int catching

bobdylan75
bobdylan75 asked
on
HI,
I have a string STR='5+5'
so in rpgle,
I try this:
EVAL NUM = %INT(STR)
How to catch the error in order to resume it
and to alert the user that STR contains wrong data?
thanks
Comment
Watch Question

Author

Commented:
I explain better:
STR=' 55'; EVAL NUM = %INT(STR)
ok
STR='001'; EVAL NUM = %INT(STR)
ok
STR='+50'; EVAL NUM = %INT(STR)
ok
STR='-50'; EVAL NUM = %INT(STR)
ok

STR='5+5'; EVAL NUM = %INT(STR)
WRONG! I don't want that my rpgle program exits.


VP Technology / Senior Consultant
Commented:

Author

Commented:
wow!
thanks
Gary PattersonVP Technology / Senior Consultant

Commented:
Happy to help.