IBM AS/400 manual Exception Handling Overview

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 246
Image 246

Exception Handling Overview

¹ If there is no

*PSSR and

a

function check occurs, the procedure

i

from

the

call stack

and

the

exception

is percolated

to

the

caller.

¹ Since

an

inquiry

message

is

never issued for an error in

a

subproc

do not have access to the

'Retry' function

available

for

some

I/O

expect record-lock errors

in

a subprocedure,

you should

code

an

e

or an

'E'

extender

and check if the

status

is related

to

a

recor

Note that the PSDS and INFDS have module scope. Both main procedures an subprocedures can access them.

 

TIP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A *PSSR

is local

to

the procedure

in

which it is coded;

therefore,

common

error routine, you

can code

a

procedure to handle

the error

the procedure

from

each

local *PSSR.

 

 

 

 

 

 

 

 

 

 

 

Differences

between

OPM

and

ILE

RPG

Exception

Handling

 

 

 

 

 

 

 

 

 

 

For

the

most

part,

exception

handling

behaves

the

same

in

OPM

RPG

and

RPG. The

key

difference

lies

 

in

the

area

of

unhandled

exceptions.

 

In

OPM,

if

an

exception

occurs

and

there

is

no

RPG-specific

handler

e

an

inquiry message

is

issued.

In

ILE,

this

will

only occur

if

the

ex

tion check. If it is

not,

then the

exception will

be

passed

to

the

dure

or

program,

and

any

eligible

higher call stack entries are given

handle

the

exception.

For

 

example,

consider

the

following

example:

 

 

¹

PGM

A

calls

PGM

 

B,

which

in

turn

calls

PGM

C.

 

 

 

 

 

 

 

 

 

¹

PGM

B

has

an

error

indicator coded for the call.

 

 

 

 

 

 

¹

PGM

C

has

no

error

indicator

or

*PSSR

error

subroutine

coded.

 

 

 

¹PGM C gets an exception.

In OPM, an inquiry message would be issued for PGM C. In ILE, the ex percolated to PGM B, since it is unhandled by PGM C. The error indicat B is turned on allowing PGM B to handle the error, and in the process abnormally. There is no inquiry message.

If

PGM C

has

a

*PSSR

error subroutine

coded,

then in both OPM and ILE,

exception

is

handled by PGM C and the error

subroutine

is run.

Note:

Inquiry

messages

issued by ILE

RPG will start with

the prefix '

 

'RPG',

as

in

OPM

RPG.

 

 

 

Certain behavioral differences exist for some specific errors. See Ap “Behavioral Differences Between OPM RPG/400 and ILE RPG for AS/400” on page 373 for further information.

222 ILE RPG for AS/400 Programmer's Guide

Page 246
Image 246
IBM AS/400 manual Exception Handling Overview