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

Cobol Runtime error handling library
Dear Sir
How do i access the cobol runtime error handling library and get the
values such as error codes and message description? Can i get the line
number where the error has occured.Also please tell me where i can see
the library variables declaration like error code and message.
Can i create a error library of my own using the available variables


Report this thread to moderator Post Follow-up to this message
Old Post
balaji.a@3i-infotech.com
05-22-06 11:55 PM


Re: Cobol Runtime error handling library
Probably not (to most of your questions) BUT it depends upon the compiler an
d
the operating system.  Please tell us that information and whether you have
already checked the vendor's documentation.

--
Bill Klein
wmklein <at> ix.netcom.com
<balaji.a@3i-infotech.com> wrote in message
news:1148310733.062914.8670@g10g2000cwb.googlegroups.com...
> Dear Sir
> How do i access the cobol runtime error handling library and get the
> values such as error codes and message description? Can i get the line
> number where the error has occured.Also please tell me where i can see
> the library variables declaration like error code and message.
> Can i create a error library of my own using the available variables
>



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
05-22-06 11:55 PM


Re: Cobol Runtime error handling library
William M. Klein wrote:
> Probably not (to most of your questions) BUT it depends upon the compiler 
and
> the operating system.  Please tell us that information and whether you hav
e
> already checked the vendor's documentation.
>
> --
> Bill Klein
>  wmklein <at> ix.netcom.com
> <balaji.a@3i-infotech.com> wrote in message
> news:1148310733.062914.8670@g10g2000cwb.googlegroups.com... 



Dear Mr.Klein
The operating system is Red hat linux 4.0 and the compiler is MFcobol
compiler.


Report this thread to moderator Post Follow-up to this message
Old Post
Bala
05-23-06 02:55 AM


Re: Cobol Runtime error handling library
balaji.a@3i-infotech.com wrote:

>  How do i access the cobol runtime error handling library and get the
> values such as error codes and message description?

There is a list of error codes and descriptions in the
${COBDIR}/rts.err file. The details you will find in your manuals.

> Can i get the line number where the error has occured.

If a fatal error occurs in your program the run-time should display
some details incluing the line number.

> Also please tell me where i can see
> the library variables declaration like error code and message.
> Can i create a error library of my own using the available variables

Perhaps this will help:

http://www.microfocus.com/000/20020..._tcm21-6431.pdf


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
05-23-06 08:55 AM


Re: Cobol Runtime error handling library
<balaji.a@3i-infotech.com> wrote in message
news:1148310733.062914.8670@g10g2000cwb.googlegroups.com...
> Dear Sir
> How do i access the cobol runtime error handling library and get the
> values such as error codes and message description? Can i get the line
> number where the error has occured.Also please tell me where i can see
> the library variables declaration like error code and message.
> Can i create a error library of my own using the available variables
>
You are confusing Visual Basic with COBOL.

What makes you think that COBOL (any implementation) has these facilities?

It has other debugging facilities and other error handling facilities.

Pete.




Report this thread to moderator Post Follow-up to this message
Old Post
Pete Dashwood
05-23-06 08:55 AM


Re: Cobol Runtime error handling library

> The operating system is Red hat linux 4.0 and the compiler is MFcobol
> compiler.

Look at the function CBL_ERROR_PROC where you can set your own handler.
You will get the error number and description as a parameter of your
handler. Probably you'll need to parse it.
If you planning to have your handler in C/C++ the functions "cobsavenv" and
"coblongjmp" might also be useful.

Regards,
Sergey



Report this thread to moderator Post Follow-up to this message
Old Post
Sergey Kashyrin
05-23-06 12:55 PM


Re: Cobol Runtime error handling library
Thank you sir.I am currently using CBL_ERROR_PROC procedure to log in
the details.My problem is that when a sub program called by main
program faces a run time error then the whole application terminates,
but instead can i stop the sub program and return the control back to
the called program.Is that possible in cobol.

Awaiting Your Reply
Thanks and Regards
Balaji


Report this thread to moderator Post Follow-up to this message
Old Post
Bala
05-24-06 02:55 AM


Re: Cobol Runtime error handling library
> My problem is that when a sub program called by main
> program faces a run time error then the whole application terminates,
> but instead can i stop the sub program and return the control back to
> the called program.Is that possible in cobol.

Many of the errors are fatal. For these, no, you cannot just 'return
control back to the sub-program'.

Most of the other errors can, or must, be coded around so that you
don't get the error in the first place.  For example if you get a
"9/002, File not Open when access attempted" the only solution is to
recode to ensure that the file is opened or that access is not
attempted if it can't be. Returning to the program will do no good at
all.

Some can be handled by code changes or possibly by compiler or run-time
switches. For example "9/048, Divide by zero" should be avoided by
checking divisors first, or by having ON SIZE ERROR, but it can be
avoided by setting run-time switch O off or by using the CHECKDIV
compiler directive, but note that the result is undifined and you may
get rubbish if the program uses the result of the divide.

You seem to want to have the program continue regardless that the
output will be junk.  Make the programs work correctly.


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
05-24-06 08:55 AM


Re: Cobol Runtime error handling library
"Bala" <balaji.a@3i-infotech.com> wrote in message
news:1148441525.841600.9590@i39g2000cwa.googlegroups.com...
> Thank you sir.I am currently using CBL_ERROR_PROC procedure to log in
> the details.My problem is that when a sub program called by main
> program faces a run time error then the whole application terminates,
> but instead can i stop the sub program and return the control back to
> the called program.Is that possible in cobol.
>
Yes, it is possible in at least three flavours of COBOL I know.

But, you may need to use an OS hook (like ESTAE for IBM mainframes), or  INT
xx for DOS on PCs or certain Win API calls like
'SetUnhandledExceptionFilter', 'RaiseException', 'ExitThread' etc., so it is
fair to say that cOBOL does not directly support this.

You should check your Manual for DECLARATIVES. These may enble you to trap
problems without the COBOL system aborting. You can then handle the error
yourself in the subroutine (if it is recoverable) and return to the calling
program if you want to do that. Be careful. Some COBOL systems only allow
DECLARATIVES at the 'top' level (there can only be one set of DECLARATIVES
for the run unit), and any error anywhere will activate them

Richard is right. This is not good practice and I wouldn't do it myself.

Pete.

> Awaiting Your Reply

Now you have it... :-)

> Thanks and Regards
> Balaji
>
>




Report this thread to moderator Post Follow-up to this message
Old Post
Pete Dashwood
05-24-06 12:55 PM


Re: Cobol Runtime error handling library
Balaji,

I don't see any problems to use cobsavenv and setjmp (sigsetjmp on Solaris)
in the main program to setup "returning point" and than from the handler to
call coblongjmp to jump to this "returning point".
I don't know Cobol that well but I don't see any problems to use those 3
functions directly from Cobol.
The only thing is that both main and handler must be able to access the same
data area (GLOBAL ?) where cobsavenv and setjmp will be saving their data.
You should call setjmp with a parameter of the return value of cobsavenv and
watch for the return value of setjmp.

Regards,
Sergey


"Bala" <balaji.a@3i-infotech.com> wrote in message
news:1148441525.841600.9590@i39g2000cwa.googlegroups.com...
> Thank you sir.I am currently using CBL_ERROR_PROC procedure to log in
> the details.My problem is that when a sub program called by main
> program faces a run time error then the whole application terminates,
> but instead can i stop the sub program and return the control back to
> the called program.Is that possible in cobol.
>
> Awaiting Your Reply
> Thanks and Regards
> Balaji
>



Report this thread to moderator Post Follow-up to this message
Old Post
Sergey Kashyrin
05-25-06 08:55 AM


Sponsored Links




Last Thread Next Thread Next
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:54 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.