IBM AS/400 manual Specifying a Return Point

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 261
Image 261

5. The ENDSR operation receives control, and the procedure is cancele

The approach used here to avoid looping can also be used within an subroutine.

Specifying a Return Point

in

the

 

ENDSR

Operation

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

When

using an INFSR or *PSSR error subroutine

in a main procedure, you

indicate

the

return

point

at

which the program will resume processing

one

of

the

following

as

the

 

Factor 2 entry of the ENDSR statement. T

be

a six-position character

 

field, literal, named constant, array ele

name

whose

value

specifies

one

of

the

following

return

points.

 

 

 

Note:

If the return points are specified

 

as literals, they must be

 

trophes

and

entered

in

uppercase

(for

example,

*DETL,

not

*detl).

 

are specified in fields or

array

elements,

the

value

must

be

 

the

field or array element.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

*DETL

 

Continue at the beginning of detail lines.

 

 

 

 

 

 

 

 

*GETIN

 

Continue at the get input record routine.

 

 

 

 

 

 

 

 

*TOTC

 

Continue at the beginning of total calculations.

 

 

 

 

 

 

 

*TOTL

 

Continue at the beginning of total lines.

 

 

 

 

 

 

 

 

 

*OFL

 

Continue at the beginning of overflow lines.

 

 

 

 

 

 

 

 

*DETC

 

Continue at the beginning of detail

 

calculations.

 

 

 

 

 

 

*CANCL

 

Cancel the processing of the program.

 

 

 

 

 

 

 

 

 

 

Blanks

 

Return

control

to

 

the

ILE RPG default exception handler. This

 

 

when

Factor 2 is

a

 

valueandof whenblanksFactor

2

is

not

specified.

 

 

the subroutine was called by the

 

EXSR

operation

and

Factor

 

 

 

control returns to the next sequential

instruction.

 

 

 

 

 

 

After the

ENDSR

operation

 

of

 

the INFSR or the *PSSR subroutine is run,

RPG

compiler resets the field or array element specified in Factor

 

Because Factor 2 is set to

blanks,

you

can

specify

the

return

poi

routine

that

is

 

best

suited

for

the

exception

that

occurred.

 

 

If

this

field

contains

blanks

at the end of the subroutine, the I

tion

handler

receives

control

 

following

the

running

of

the

subroutine,

u

INFSR

or

the

*PSSR

subroutine

was

called

by

the EXSR operation. If t

tine

was called by the EXSR

operation

and

 

Factor 2 of the ENDSR ope

blank, control returns to the

 

next

sequential

instruction

following

the

E

tion.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Note:

You cannot specify a factor

2

 

entry

for

an

ENDSR

in

a

 

subproc

 

want to resume processing in the subprocedure, you have to us

 

operation to a TAG in the

body

 

of

the

subprocedure.

Alternativ

 

code a

RETURN

operation

in

the

 

*PSSR.

 

The

subprocedure

will

then

 

to

the

caller.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Chapter 12. Handling Exceptions237

Page 261
Image 261
IBM AS/400 manual Specifying a Return Point