Set COBOL Error Handler (QlnSetCobolErrorHandler) API


  Required Parameter Group:

1 New error-handling exit procedure pointer Input Anyptr
2 Current error-handling exit procedure pointer Output Anyptr
3 Error code I/O Char(*)

  Default Public Authority: *USE

  Threadsafe: No

The Set COBOL Error Handler (QlnSetCobolErrorHandler) API allows you to specify the identity of a COBOL error-handling procedure. You can call it from any ILE programming language; however, this API only sets the procedure pointer of the error-handling program that is called when an error occurs in an ILE COBOL/400 program.

After you call this API, any ILE COBOL/400 program that issues an inquiry message with options C, D, or F will first call the defined error-handling procedure. This procedure receives the message identification and substitution text, as well as the name of the program that received it, and a list of valid 1-character responses. The defined procedure is responsible for returning a 1-character code (blank, C, D, F, or G) indicating whether the COBOL program should continue or not.

Note: All messages issued by the operating system during the running of a COBOL program are monitored by the COBOL program. Only some of the system messages issued will result in a COBOL inquiry message.

You can define a different error-handling procedure for each activation group.

Only one ILE error-handling procedure can be active at a time. If an error occurs in the error-handling procedure, the COBOL program does not call the error-handling procedure again. (In other words, recursive calls do not occur.) Instead, the inquiry message would be issued as if no error-handling procedure were defined.

You cannot change the error-handling procedure while it is responding to an error in a COBOL program.

If an error occurs during the calling of the error-handling procedure, an informational message (LNR7430) is issued, and processing continues as if no error-handling procedure were defined.

The error-handling procedure is defined by the user. The parameters aredescribed under ILE COBOL Error-Handling Exit Procedure.


Authorities and Locks

None.


Required Parameter Group

New error-handling exit procedure pointer
INPUT; ANYPTR

The pointer to the new error-handling procedure that you want to set.

Current error-handling exit procedure pointer
OUTPUT; ANYPTR

The pointer to the error-handling procedure that was in place before the new error-handling procedure was set.

Valid values are:

NULL No current error-handling exit procedure was found.
procedure-pointer The pointer to the error-handling procedure.

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.


Error Messages

Message ID Error Message Text
CPF3C90 E Literal value cannot be changed.
LNR7074 E Error code not valid.
LNR7075 E Error addressing API parameters.
LNR7077 E Procedure reference not valid.


API introduced: V2R2
Top | High-level language APIs | APIs by category