Code Comments
Programming Forum and web based access to our favorite programming groups.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
Post Follow-up to this messageProbably 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 >
Post Follow-up to this messageWilliam 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.
Post Follow-up to this message
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
Post Follow-up to this message<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.
Post Follow-up to this message> 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
Post Follow-up to this messageThank 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
Post Follow-up to this message> 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.
Post Follow-up to this message"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 > >
Post Follow-up to this messageBalaji, 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 >
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.