Identifying runtime errors

Fortran has several features that help you find runtime errors. Fortran runtime messages are discussed in z/OS Language Environment Runtime Messages. Other debugging aids include the optional traceback map, program interruption messages, abnormal termination dumps, and operator messages.
  • The optional traceback map helps you identify where errors occurred while running your application. The TERMTHDACT(TRACE) runtime option, which is set by default under Language Environment, generates a dump containing the traceback map.

    You can also get a traceback map at any point in your routine by invoking the ERRTRA subroutine.

  • Program interruption messages are generated whenever the program is interrupted during execution. Program interruption messages are written to the Language Environment message file.

    The program interruption message indicates the exception that caused the termination; the completion code from the system indicates the specification or operation exception resulting in termination.

  • Program interruptions causing an abnormal termination produce a dump, which displays the completion code and the contents of registers and system control fields.
    To display the contents of main storage as well, you must request an abnormal termination (ABEND) dump by including a SYSUDUMP DD statement in the appropriate job step. The following example shows how the statement can be specified for IBM-supplied cataloged procedures:
    //GO.SYSUDUMP DD SYSOUT=A
  • You can request various dumps by invoking any of several dump service routines while your program runs. These dump service routines are discussed in Generating a Language Environment dump of a Fortran routine.
  • Operator messages are displayed when your program issues a PAUSE or STOP n statement. These messages help you understand how far execution has progressed before reaching the PAUSE or STOP statement.
    The operator message can take the following forms:
    n
    String of 1–5 decimal digits you specified in the PAUSE or STOP statement. For the STOP statement, this number is placed in R15.
    'message'
    Character constant you specified in the PAUSE or STOP statement.
    0
    Printed when a PAUSE statement containing no characters is executed (not printed for a STOP statement).

    A PAUSE message causes the program to stop running pending an operator response. The format of the operator's response to the message depends on the system being used.

  • Under Language Environment, error messages produced by Language Environment and Fortran are written to a common message file. Its ddname is specified in the MSGFILE runtime option. The default ddname is SYSOUT.
    Fortran information directed to the message file includes:
    • Error messages resulting from unhandled conditions
    • Printed output from any of the dump services (SDUMP, DUMP/PDUMP, CDUMP/CPDUMP)
    • Output produced by a WRITE statement with a unit identifier having the same value as the Fortran error message unit
    • Output produced by a WRITE statement with * given as the unit identifier (assuming the Fortran error message unit and standard print unit are the same unit)
    • Output produced by the PRINT statement (assuming the Fortran error message unit and the standard print unit are the same unit)

    For more information about handling message output using the Language Environment MSGFILE runtime option, see z/OS Language Environment Programming Guide.