As you plan and code, you naturally attempt to create a perfect program-one that will be bug-free and run without error. But it is unrealistic to believe that problems will never occur during your program's execution. Even if your own code is flawless, errors may occur in the system facilities that your program uses. Anticipate these possibilities by putting code into your program to handle them. Such code can be thought of as built-in distress flares or lifeboats. If such error-handling code is not present in your program, it could ruin your output data and files, and you might not even be aware of the problem.
The action taken by your error-handling code can vary from attempting to cope with the situation and continue, to issuing a message, to halting execution. In any event, coding a warning message is a good idea. You might be able to create your own error-detection routines for data-entry errors or for errors as your installation defines them. VS COBOL II contains special elements to help you anticipate and correct error conditions. These fall into four main areas:
You can cause a dump at any pre-specified point in your program by coding a call to the library routine ILBOABNO, for example:
nnnn becomes the identifier in the nnnn user abend code produced with the resultant dump. Because of system limits, do not specify a value greater than 4095 for the user abend code. ILBOABNO is an RMODE(ANY) routine. It can be called statically or dynamically and can be passed a completion code variable from above the 16-megabyte line.
To force an abend at any point in your program, code: CALL 'ILBOABNO' USING data-name
This should not be used under CICS; instead, use the EXEC CICS ABEND command.
When your program performs arithmetic operations, the results may be larger than the fixed-point field that is to hold them, or you may have attempted a division by 0. In either case, the ON SIZE ERROR clause after the ADD, SUBTRACT, MULTIPLY, DIVIDE, or COMPUTE statement can handle the situation.
If you code the ON SIZE ERROR clause, the imperative statement of your clause will be executed and your result field will not be changed in the following five cases:
You should be aware that floating-point exponent overflow, which occurs when the value of a floating-point arithmetic computation cannot be represented in the System-370 floating-point operand format, does not cause SIZE ERROR; an abend occurs instead.
STRING and UNSTRING Operations
When stringing or unstringing data, the pointer may fall beyond or short of the receiving field. In this case, a potential overflow condition exists. Although COBOL will not let the overflow actually occur, the STRING/UNSTRING operation will not be completed. If you do not have an ON OVERFLOW clause on the STRING or UNSTRING statement, control passes to the next sequential statement, and you are not notified of the incomplete operation.
When dynamically calling a separately compiled program, the program that you call may be unavailable to the system. For example, the system may be out of storage or it may be unable to locate the load module. If you do not have an ON EXCEPTION or ON OVERFLOW clause on the CALL statement, your application may abnormally end (abend).
You can use the ON EXCEPTION clause to execute a series of statements and to perform your own error handling. So when you use an ON EXCEPTION statement and if the called program is unavailable, control will continue with the ON EXCEPTION clause.
The ON EXCEPTION clause applies only to the availability of the called program. If an error occurs while the called program is running, the ON EXCEPTION clause will not be executed
IBM Mainframe Related Interview Questions
|IBM Lotus Notes Interview Questions||IBM-CICS Interview Questions|
|COBOL Interview Questions||Linux Interview Questions|
|IBM-JCL Interview Questions||IBM Mainframe Interview Questions|
|IBM AIX Interview Questions||IBM WAS Administration Interview Questions|
|IBM Lotus Domino Interview Questions||IBM Integration Bus Interview Questions|
|Mainframe DB2 Interview Questions||Unix Production Support Interview Questions|
Ibm Mainframe Tutorial
Introduction To Software Development
Introduction To Ibm Mainframes
Tso And Ispf
Jes2, ]es3 And Sms
Introduction To Job Control Language (jcl)
The Job Statement
The Exec Statement
The Job And Exec Statements
The Dd Statement
Procedures And Symbolic Parameters
Generation Data Groups (gdg), Compile/link-edit And Run Jcls
Access Method Services (ams)
Additional Vsam Commands
Introduction To Rexx
Overview Of Rexx
Introduction To Cics
Exception Handling In Cics
Developing A Cics Application
Cics Programming Techniques
Basic Mapping Support (bms)
Transient Data Control
Temporary Storage Control
Interval And Task Control
Cics Application Design
Recovery And Restart
System Security And Intersystem Communication
Cics Debugging Facilities And Techniques
Bms Map Definition Macros And Copylib Members
Cics Response And Abend Codes
Data, Information And Information Processing
Introduction To Database Management Systems
Introduction To Relational Database Management Systems
Database Architecture And Data Modeling
Overview Of Db2
Structured Query Language (sql)
Data Security And Access
Db2 Application Development
Qmf And Db2i
Db2 Performance Monitoring, Utilities And Recovery/restart
Overview Of Information Management System (ims)
Introduction To Vs Cobol Ii
Overview Of Application Development In Vs Cobol Ii
Overview Of The Cobol Program
Sorting And Merging Files
Coding Cobol Programs That Run Under Cics. Ims, Db2 And Ispf
Compiling The Program
Link-editing The Program
Executing The Program
Improving Program Performance
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.