Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

exception handling for intrinsic functions
Can someone point me in the right direction to a section of a manual that
describes how to handle when an intrinsic function is called with invalid
data.  For instance, I do the following:

move "1 23.4" to my-string
compute my-val = function numval-c(my-string)

This causes an LE COBOL runtime error of:
"IGZ0152S Invalid character 3 was found in column 5 in argument-1 for
function NUMVAL-C in program TEST6 at displacement X'0402'. From compile
unit TEST6 at entry point TEST6 at compile unit offset +00000402 at address
0060047A."

I guess my main question is, must I pre-validate my data before calling the
function or is there some way I can "capture" the run-time error and send a
sensible error message to my user?  If the latter, how (in general) do I do
it?

I am using IBM COBOL for VSE/ESA, but I'm sure IBM Enterprise COBOL for z/OS
et al are similar, so answers based on that product would probably be OK.

Thanks!


---
Frank Swarbrick
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO  USA

Report this thread to moderator Post Follow-up to this message
Old Post
Frank Swarbrick
04-15-04 04:30 PM


Re: exception handling for intrinsic functions
Frank Swarbrick wrote:
> Can someone point me in the right direction to a section of a manual
> that describes how to handle when an intrinsic function is called
> with invalid data.  For instance, I do the following:
>
> move "1 23.4" to my-string
> compute my-val = function numval-c(my-string)
>
> This causes an LE COBOL runtime error of:
> "IGZ0152S Invalid character 3 was found in column 5 in argument-1 for
> function NUMVAL-C in program TEST6 at displacement X'0402'. From
> compile unit TEST6 at entry point TEST6 at compile unit offset
> +00000402 at address 0060047A."
>
> I guess my main question is, must I pre-validate my data before
> calling the function or is there some way I can "capture" the
> run-time error and send a sensible error message to my user?  If the
> latter, how (in general) do I do it?
>
> I am using IBM COBOL for VSE/ESA, but I'm sure IBM Enterprise COBOL
> for z/OS et al are similar, so answers based on that product would
> probably be OK.
>

Sigh.

It would be nice to have such a property, wouldn't it?



Report this thread to moderator Post Follow-up to this message
Old Post
JerryMouse
04-15-04 06:30 PM


Re: exception handling for intrinsic functions
In article <c5m7bn$3dl1p$1@ID-184804.news.uni-berlin.de>,
"Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote:

> Can someone point me in the right direction to a section of a manual that
> describes how to handle when an intrinsic function is called with invalid
> data.  For instance, I do the following:
>
> move "1 23.4" to my-string
> compute my-val = function numval-c(my-string)
>
> This causes an LE COBOL runtime error of:
> "IGZ0152S Invalid character 3 was found in column 5 in argument-1 for
> function NUMVAL-C in program TEST6 at displacement X'0402'. From compile
> unit TEST6 at entry point TEST6 at compile unit offset +00000402 at addres
s
> 0060047A."
>
> I guess my main question is, must I pre-validate my data before calling th
e
> function or is there some way I can "capture" the run-time error and send 
a
> sensible error message to my user?  If the latter, how (in general) do I d
o
> it?
>
> I am using IBM COBOL for VSE/ESA, but I'm sure IBM Enterprise COBOL for z/
OS
> et al are similar, so answers based on that product would probably be OK.
>
> Thanks!


You could use an LE condition handler with a resume point.  That is
something of a pain though.

I have found that a state machine that validates the input data to be a
valid numeric works well.

Report this thread to moderator Post Follow-up to this message
Old Post
Joe Zitzelberger
04-16-04 12:30 AM


Re: exception handling for intrinsic functions
First, what happens with Intrinsic Functions given invalid inputs for an
ANSI/ISO '89 conforming compiler is UNFORTUNATELY "undefined".  It fact, som
e
compilers are relatively forgiving and some are really QUITE unforgiving. IB
M
(all of the compilers that I know) is (again unfortunately) in the latter
category and tends to ABEND when it happens.

The ISO 2002 COBOL Standard "fixes" this in two ways:

1) In general, there are "exceptions" raised - that can be tested and handle
d -
within a program for ANY intrinsinsic function "feed" an invalid argument.

2) For many (not all) of the Intrinsic Functions there are new "TEST-xxx"
functions.  This includes all the NumVal-xxx and Date functions.

Frank - you and I have discussed (off-line) what to do about COBOL (and LE)
"requirements" and VSE.  However, your VSE group, might be interested in two
SHARE requirements.

- SSLNGC0313599 "2002 ISO COBOL - TEST-xxxx Intrinsic Functions"
(this requirement was submitted last year and received a user priority of 3.
1
of a possible 5)

- SSLNGC0413611 "ISO 2002 - Common exception processing"
(this requirement is currently "Out for Vote"

Implementation (by IBM or any other vendor) of BOTH of this specifications w
ould
"solve" your problem quite nicely.  Without them, you are required to "parse
"
(using all the argument rules) all your arguments - which pretty much defeat
s
(IMHO) the benefit of the Intrinsic Functions.

If you need any detail on the current requirements (so they can be submitted
against IBM VSE compiler) let me know off-line.

--
Bill Klein
wmklein <at> ix.netcom.com
"Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote in message
news:c5m7bn$3dl1p$1@ID-184804.news.uni-berlin.de...
> Can someone point me in the right direction to a section of a manual that
> describes how to handle when an intrinsic function is called with invalid
> data.  For instance, I do the following:
>
> move "1 23.4" to my-string
> compute my-val = function numval-c(my-string)
>
> This causes an LE COBOL runtime error of:
> "IGZ0152S Invalid character 3 was found in column 5 in argument-1 for
> function NUMVAL-C in program TEST6 at displacement X'0402'. From compile
> unit TEST6 at entry point TEST6 at compile unit offset +00000402 at addres
s
> 0060047A."
>
> I guess my main question is, must I pre-validate my data before calling th
e
> function or is there some way I can "capture" the run-time error and send 
a
> sensible error message to my user?  If the latter, how (in general) do I d
o
> it?
>
> I am using IBM COBOL for VSE/ESA, but I'm sure IBM Enterprise COBOL for z/
OS
> et al are similar, so answers based on that product would probably be OK.
>
> Thanks!
>
>
> ---
> Frank Swarbrick
> Senior Developer/Analyst - Mainframe Applications
> FirstBank Data Corporation - Lakewood, CO  USA



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
04-16-04 12:30 AM


Re: exception handling for intrinsic functions
How very discouraging.  It seems like such a waste for me to validate a
field that the function is going to validate anyway!

Most of our current numeric data validation is pretty basic.  We simple use
the CICS BIF DEEDIT to remove all non-numeric data, and we assume the user
has entered both dollars and cents.  Some of our programs actually do a bit
more editing to check for existence a decimal point, but that's about it.
(Of course we always display the post-edited field back to the user and have
them verify that they entered what they meant to enter.)

I was thinking that NUMVAL or NUMVAL-C might be useful, but if I have to do
my own validation anyway I'm not sure I see the point!  Ugh.  Of course I
guess I could write a sub-routine that anyone could use, so maybe it will
still be worthwhile, but it's still frustrating.


---
Frank Swarbrick
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO  USA
 
Frank Swarbrick wrote:
> Can someone point me in the right direction to a section of a manual
> that describes how to handle when an intrinsic function is called
> with invalid data.  For instance, I do the following:
>
> move "1 23.4" to my-string
> compute my-val = function numval-c(my-string)
>
> This causes an LE COBOL runtime error of:
> "IGZ0152S Invalid character 3 was found in column 5 in argument-1 for
> function NUMVAL-C in program TEST6 at displacement X'0402'. From
> compile unit TEST6 at entry point TEST6 at compile unit offset
> +00000402 at address 0060047A."
>
> I guess my main question is, must I pre-validate my data before
> calling the function or is there some way I can "capture" the
> run-time error and send a sensible error message to my user?  If the
> latter, how (in general) do I do it?
>
> I am using IBM COBOL for VSE/ESA, but I'm sure IBM Enterprise COBOL
> for z/OS et al are similar, so answers based on that product would
> probably be OK.
>

Sigh.

It would be nice to have such a property, wouldn't it?





Report this thread to moderator Post Follow-up to this message
Old Post
Frank Swarbrick
04-16-04 04:30 PM


Re: exception handling for intrinsic functions
LE condition handler, huh?  I've yet to understand how these work, and why
they'd be worth the effort to even learn more about it.  Does anyone
actually use this "fancy shmancy" LE stuff?

Frank
 
In article <c5m7bn$3dl1p$1@ID-184804.news.uni-berlin.de>,
"Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote:

> Can someone point me in the right direction to a section of a manual that
> describes how to handle when an intrinsic function is called with invalid
> data.  For instance, I do the following:
>
> move "1 23.4" to my-string
> compute my-val = function numval-c(my-string)
>
> This causes an LE COBOL runtime error of:
> "IGZ0152S Invalid character 3 was found in column 5 in argument-1 for
> function NUMVAL-C in program TEST6 at displacement X'0402'. From compile
> unit TEST6 at entry point TEST6 at compile unit offset +00000402 at
address
> 0060047A."
>
> I guess my main question is, must I pre-validate my data before calling
the
> function or is there some way I can "capture" the run-time error and send
a
> sensible error message to my user?  If the latter, how (in general) do I
do
> it?
>
> I am using IBM COBOL for VSE/ESA, but I'm sure IBM Enterprise COBOL for
z/OS
> et al are similar, so answers based on that product would probably be OK.
>
> Thanks!


You could use an LE condition handler with a resume point.  That is
something of a pain though.

I have found that a state machine that validates the input data to be a
valid numeric works well.



Report this thread to moderator Post Follow-up to this message
Old Post
Frank Swarbrick
04-16-04 04:30 PM


Re: exception handling for intrinsic functions
Thanks for the input.  I'm considering writing a WAVV requirement to
implement (as much as possible, anyway) the 2002 COBOL standard.  I can't
imagine it would be useful to make a separate requirement for each little
feature of the new standard, can you?  I mean, while there's some of it I
don't care much about there is also a huge number of new features I'd like
to see implemented; the ones you mention being two of them.

Frank
 
First, what happens with Intrinsic Functions given invalid inputs for an
ANSI/ISO '89 conforming compiler is UNFORTUNATELY "undefined".  It fact,
some
compilers are relatively forgiving and some are really QUITE unforgiving.
IBM
(all of the compilers that I know) is (again unfortunately) in the latter
category and tends to ABEND when it happens.

The ISO 2002 COBOL Standard "fixes" this in two ways:

1) In general, there are "exceptions" raised - that can be tested and
handled -
within a program for ANY intrinsinsic function "feed" an invalid argument.

2) For many (not all) of the Intrinsic Functions there are new "TEST-xxx"
functions.  This includes all the NumVal-xxx and Date functions.

Frank - you and I have discussed (off-line) what to do about COBOL (and LE)
"requirements" and VSE.  However, your VSE group, might be interested in
two
SHARE requirements.

- SSLNGC0313599 "2002 ISO COBOL - TEST-xxxx Intrinsic Functions"
(this requirement was submitted last year and received a user priority of
3.1
of a possible 5)

- SSLNGC0413611 "ISO 2002 - Common exception processing"
(this requirement is currently "Out for Vote"

Implementation (by IBM or any other vendor) of BOTH of this specifications
would
"solve" your problem quite nicely.  Without them, you are required to
"parse"
(using all the argument rules) all your arguments - which pretty much
defeats
(IMHO) the benefit of the Intrinsic Functions.

If you need any detail on the current requirements (so they can be
submitted
against IBM VSE compiler) let me know off-line.

--
Bill Klein
wmklein <at> ix.netcom.com
"Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote in message
news:c5m7bn$3dl1p$1@ID-184804.news.uni-berlin.de...
> Can someone point me in the right direction to a section of a manual that
> describes how to handle when an intrinsic function is called with invalid
> data.  For instance, I do the following:
>
> move "1 23.4" to my-string
> compute my-val = function numval-c(my-string)
>
> This causes an LE COBOL runtime error of:
> "IGZ0152S Invalid character 3 was found in column 5 in argument-1 for
> function NUMVAL-C in program TEST6 at displacement X'0402'. From compile
> unit TEST6 at entry point TEST6 at compile unit offset +00000402 at
address
> 0060047A."
>
> I guess my main question is, must I pre-validate my data before calling
the
> function or is there some way I can "capture" the run-time error and send
a
> sensible error message to my user?  If the latter, how (in general) do I
do
> it?
>
> I am using IBM COBOL for VSE/ESA, but I'm sure IBM Enterprise COBOL for
z/OS
> et al are similar, so answers based on that product would probably be OK.
>
> Thanks!
>
>
> ---
> Frank Swarbrick
> Senior Developer/Analyst - Mainframe Applications
> FirstBank Data Corporation - Lakewood, CO  USA





Report this thread to moderator Post Follow-up to this message
Old Post
Frank Swarbrick
04-16-04 04:30 PM


Re: exception handling for intrinsic functions
SHARE has a "generic" requirement - but it explicitly acknowledges the fact 
that
implementing the "whole" 2002 Standard is a LOT of work and needs to be "pha
sed
in".  Therefore, SHARE has a bunch of individual requirements that give
"priorities" on which features we want implemented first.

I would think that WAVV might find this useful too.  On the other hand, (giv
en
past experiences) my GUESS is that IBM would implement COBOL features first
under z/OS  - then under (recently previewed) z/VSE.  I think that the VSE C
OBOL
is still "sourced" based on an earlier OS/390 compiler.

--
Bill Klein
wmklein <at> ix.netcom.com
"Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote in message
news:c5org9$447bj$4@ID-184804.news.uni-berlin.de...
> Thanks for the input.  I'm considering writing a WAVV requirement to
> implement (as much as possible, anyway) the 2002 COBOL standard.  I can't
> imagine it would be useful to make a separate requirement for each little
> feature of the new standard, can you?  I mean, while there's some of it I
> don't care much about there is also a huge number of new features I'd like
> to see implemented; the ones you mention being two of them.
>
> Frank
> 
> First, what happens with Intrinsic Functions given invalid inputs for an
> ANSI/ISO '89 conforming compiler is UNFORTUNATELY "undefined".  It fact,
> some
> compilers are relatively forgiving and some are really QUITE unforgiving.
> IBM
> (all of the compilers that I know) is (again unfortunately) in the latter
> category and tends to ABEND when it happens.
>
> The ISO 2002 COBOL Standard "fixes" this in two ways:
>
> 1) In general, there are "exceptions" raised - that can be tested and
> handled -
> within a program for ANY intrinsinsic function "feed" an invalid argument.
>
> 2) For many (not all) of the Intrinsic Functions there are new "TEST-xxx"
> functions.  This includes all the NumVal-xxx and Date functions.
>
> Frank - you and I have discussed (off-line) what to do about COBOL (and LE
)
> "requirements" and VSE.  However, your VSE group, might be interested in
> two
> SHARE requirements.
>
> - SSLNGC0313599 "2002 ISO COBOL - TEST-xxxx Intrinsic Functions"
>   (this requirement was submitted last year and received a user priority o
f
> 3.1
> of a possible 5)
>
> - SSLNGC0413611 "ISO 2002 - Common exception processing"
>   (this requirement is currently "Out for Vote"
>
> Implementation (by IBM or any other vendor) of BOTH of this specifications
> would
> "solve" your problem quite nicely.  Without them, you are required to
> "parse"
> (using all the argument rules) all your arguments - which pretty much
> defeats
> (IMHO) the benefit of the Intrinsic Functions.
>
> If you need any detail on the current requirements (so they can be
> submitted
> against IBM VSE compiler) let me know off-line.
>
> --
> Bill Klein
>  wmklein <at> ix.netcom.com
> "Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote in message
> news:c5m7bn$3dl1p$1@ID-184804.news.uni-berlin.de... 
> address 
> the 
> a 
> do 
> z/OS 
>
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
04-16-04 11:30 PM


Re: exception handling for intrinsic functions
Frank Swarbrick wrote:
> Can someone point me in the right direction to a section of a manual that
> describes how to handle when an intrinsic function is called with invalid
> data.  For instance, I do the following:
>
> move "1 23.4" to my-string
> compute my-val = function numval-c(my-string)
>
> This causes an LE COBOL runtime error of:
> "IGZ0152S Invalid character 3 was found in column 5 in argument-1 for
> function NUMVAL-C in program TEST6 at displacement X'0402'. From compile
> unit TEST6 at entry point TEST6 at compile unit offset +00000402 at addres
s
> 0060047A."

I'm not an IBM-er, but I don't think (in the COBOL 85 standard) you've
got such an ability.  However, the 2002 standard provides intrinsic
validation functions so you can test the data before you pass it to the
picky function (or at least a draft I read somewhere had that in it).

> I guess my main question is, must I pre-validate my data before calling th
e
> function or is there some way I can "capture" the run-time error and send 
a
> sensible error message to my user?  If the latter, how (in general) do I d
o
> it?

The former.  You could come up with a module that you could call to do
the validation (a "pre-numval-c"), then you could start using it in
different programs...


--
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
~   /   \  /         ~        Live from Montgomery, AL!       ~
~  /     \/       o  ~                                        ~
~ /      /\   -   |  ~          LXi0007@Netscape.net          ~
~ _____ /  \      |  ~ http://www.knology.net/~mopsmom/daniel ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~         I do not read e-mail at the above address           ~
~    Please see website if you wish to contact me privately   ~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~


Report this thread to moderator Post Follow-up to this message
Old Post
LX-i
04-17-04 01:30 AM


Re: exception handling for intrinsic functions
I've found a few uses for it.  It actually isn't all that hard.  You
provide a program that you want called in case of an exception.

When an exception happens, each program is called with the exception
code.  At this point the program can ignore the problem and let another
program handle it, or it can correct the offending issue and reattempt
whatever caused the exception.

They can be strange, but if you think of them like a generic "ON
EXCEPTION" clause that can apply to any statement, they approach a
certain level of Cobolness.


In article <c5or7t$447bj$3@ID-184804.news.uni-berlin.de>,
"Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote:

> LE condition handler, huh?  I've yet to understand how these work, and why
> they'd be worth the effort to even learn more about it.  Does anyone
> actually use this "fancy shmancy" LE stuff?
>
> Frank
> 
> In article <c5m7bn$3dl1p$1@ID-184804.news.uni-berlin.de>,
>  "Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote:
> 
> address 
> the 
> a 
> do 
> z/OS 
>
>
> You could use an LE condition handler with a resume point.  That is
> something of a pain though.
>
> I have found that a state machine that validates the input data to be a
> valid numeric works well.

Report this thread to moderator Post Follow-up to this message
Old Post
Joe Zitzelberger
04-17-04 05:30 AM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:24 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.