IBM AS/400 manual Example of Unhandled Function Check, Using Exception Handlers, Note The

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 249
Image 249
Note: The

 

 

Using Exception Handlers

Note: The

same

exception handling events described would apply to a

call

(CALLB

operation) as well.

Example of Unhandled Function Check

The following scenario describes the events which occur when a funct occurs in a main procedure and is not handled. This scenario has th assumptions:

1. There are

two

programs,

PGM1

and

PGM2, each

containing a procedur

PRC1

and PRC2 respectively.

 

 

 

2. PRC1

calls

PGM2

dynamically

and

PRC2

receives

control.

3. The CALL operation code in PRC1 does not have an error indicator

4. No RPG

exception handlers have been coded

in PRC2. That is, ther

error

indicator coded and there is no *PSSR

error subroutine.

5. PRC2 has a pointer address error.

When PGM1 calls PGM2, a pointer error occurs because the basing point defined as null. Consequently, MCH1306 is generated. A function check o when PRC2 tries to percolate the exception past the control boundary depicts this scenario and the events which occur.

PASS 1

Call Stack

Active Exception Handler List

Percolate MCH3601

PASS 2

Procedure PRC1

CALL PRC2

Procedure PRC2

D FLD S 5A BASED(PTR)

CEVAL PTR=NULL C EVAL FLD='ABCDE'

MCH3601 issued

RPG default Hdlr

RPG default Hdlr

Call Stack

Active Exception Handler List

Percolate CPF9999

Procedure PRC1

CALL PRC2

Procedure PRC2

D FLD S 5A BASED(PTR)

CEVAL PTR=NULL C EVAL FLD='ABCDE'

CPF9999 issued

RPG default Hdlr

RPG default Hdlr

Figure 110. Scenario for Unhandled Function Check

Chapter 12. Handling Exceptions225

Page 249
Image 249
IBM AS/400 manual Example of Unhandled Function Check, Using Exception Handlers, Note The