Skip to main content

Problem:

How to interpret Micro Focus runtime error values.

Resolution:

BUILD W/RELEASE:     Any Micro Focus Cobol product.

                                 

INTRODUCTION

==========

This isn't a programming example, although a program is part of the illustration. What it is about is how COBOL Run-time errors are sometimes mis-handled by application programs.

SOURCE FILES:

==========

Program Files      Description

----------------      -----------------------------------------------------------

Rte.cbl                Example COBOL program that creates a list of possible Run-time errors in                                         both a pure numeric format and a file status format.

RTErrors.txt       The list produced by Rte.cbl

REQUIREMENTS:

==========

Run-time errors will show up as file status values and the return value from certain call-by-name routines. The file status definition should be defined as follows:

    1   file-status.

    2   file-status-1  pic x.

    2   run-time-error pic x comp-x.

When the first byte of file-status (file-status-1) is an ASCII "9" then the run-time-error field will contain a COBOL Run-time error number, 001 through 255. You can test file-status for "00" and because it is a group item your test will function correctly. When it fails (not equal to

"00") test file-status-1 equal to "9". When this test is true you have a Run-times error which can be dislayed as "9/" run-time-error. If file-status-1 is not equal to "9" then you have a normal file status that can be displayed as file-status.

When you are using call-by-name routines that manipulate data files (CBL_CHECK_FILE_EXIST, CBL_COPY_FILE) these routines return a status-code defined as pic xx comp-5.  These routines return a non zero value when they fail. The value is usually a Run-time error. The correct Run-time error can be displayed as shown in the Rte.cbl program. The comp-5 status-code must be moved to a comp-x field (aWord) and the result will be a correctly formatted file status,

Run-time error.

Happy error handling!

OPERATION:

========

REFERENCES

========

Manual File Handling, chapter File Handler API.

==========================================================

Keywords: Example, sample, demo, demonstration, run-timeerrors.zip, runtime

demo.ex

demo.ne

demo.se

Attachments:

Run-timeErrors.zip

Old KB# 1321