Run-time Errors

Run-time errors presen t a challenging problem, frequen tly causing the program to end abnormally (abort). T o determine the answ er to a run-time error, y ou must consider the following aspects of the problem:

What is the cause or source? What is the mechanism of the abort? What information is pro vided to help trace and correct the problem? What are typical abort situations?The decision to abort a process can be made b y: User program Library routine MPE/iX intrinsic

MPE/iX operating system

A program's design can cause it to abort if bad input or some unreco verable situation occurs. The program can call the QUIT intrinsic or an equivalent compiler-determined statemen t.

In this case, the unreco verable situation is b y design; the programmer m ust provide code to handle the problem or abort the program.

A process can abort because a subsystem library routine encoun tered a problem. For example, if an HP F ORTRAN 77/iX program performs a READ statement, an HP FORTRAN 77/iX library routine is called to perform the necessary I/O. If an end-of-￿le condition is encountered, a data format problem occurs. If the library routine cannot complete the operation, it ma y abort the program.

An MPE/iX intrinsic can abort a program, depending on the individual in trinsic's requirements. For example, it ma y encounter a missing parameter, an un usable parameter value, or an unusable address. The in trinsic might require that the program ￿le ha ve a special capability to use the intrinsic.

900 Series HP 3000 hardw are or software can detect errors. F or example, if an arithmetic operation exceeds a data v alue maximum, computer hardw are detects an o ver￿ow problem. It may also detect a bad instruction or in valid address for code or data. MPE/iX aborts a program when a stac k requires more room than is a vailable. This alerts y ou to a potential problem with recursiv e calls and loops.

Abort Message Information

When MPE/iX carries out an abort for an y reason, the process m ust terminate cleanly (complete the operations it w ould have completed if it had ended normally). Ho wever, because the termination is unexpected, information ma y be lost. For example, NEW ￿les may not be retained. A message indicating the t ype of abort is prin ted before termination. After termination, Command In terpreter prints the ￿nal message line. The information in the message helps to iden tify the cause and guide y ou toward a solution to the problem.

An abort message appears in a standard format pro viding: Program ￿le name

Location at whic h the abort occurred in the program ￿le Message text describing the t ype of abort

Program Development 3-19