On Return:
This function returns
NULL if no fault or error was active when the routine was called, otherwise it returns a pointer to a struct of the form:
typedef struct
{
cbl_os_size_t symbol_offset;
const cobchar_t* symbol_name;
cbl_os_size_t module_offset;
const cobchar_t* module_name;
const cobchar_t* file_name;
cbl_os_size_t line_number;
} coberrorinfo_t
where each element is:
- symbol-name
- A null terminated string containing the name of symbol where the last fault or error occurred.
- symbol-offset
- The symbol offset to the last fault or error.
- module-name
- A null terminated string containing the name of the module where the last fault or error occurred.
- module-offset
- The module offset to the last fault or error.
- file-name
- A null terminated string containing the name of the file where the last fault or error occurred.
- line-number
- The line in the file where the last fault or error occurred.
Comments:
In the typical scenario, cobgeterrorinfo is used in an error proc, a PL/I ON-unit or a synchronous signal handler and provides information about the location of the last fault or error.
cobgeterrorinfo offers similar functionality to the CEE3GRN and CEE3GRO routines, and is expected to be used in similar circumstances. Similarly to these two mainframe calls, when an error occurs, and cobgeterrorinfo is subsequently called, it provides, for the location of the error, the symbol name and the offset from the symbol start. Additionally, cobgeterrorinfo provides the name of the module, the file name and line number. This additional information makes it easier to identify the location of a fault/error.
cobgeterrorinfo creates a structure, which should be destroyed once it is no longer needed. This is done by another function, cobfreeerrorinfo.
In PL/I, this routine can be called in an ON-unit. However, it cannot be called after the ON-unit terminates.
PL/I programs must be compiled with the -proginfo option in order to use cobgeterrorinfo.
cobgeterrorinfo cannot be called from an exit proc.
cobgeterrorinfo does not provide information about asynchronous signals.