IBM AS/400 manual Abnormal End, Returning from a Called Program or Procedure

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 177
Image 177
Returning from a Called Program or Procedure

Returning from a Called Program or Procedure

¹The RETURN operation (with a blank factor 2) is processed, the H

indicators are not on, and the LR indicator is on.

¹The RT indicator is on, the H1 through H9 indicators are not on, indicator is on.

When a main procedure ends normally, the following occurs:

¹

The Factor-2-to-Result-field

move

of

a

*ENTRY PARM operation is perfor

¹

All

arrays

and

tables with

a

'To

file

name' specified on the Def

 

tions, and

all locked

data

area

data

structures are written out.

¹

Any

data

areas

locked

by

the

procedure are unlocked.

¹

All

files

that

are

open

are

closed.

 

¹A return code is set to indicate to the caller that the proced

normally, and control then returns to the caller.

On the next call to the

main procedure, with the exception of expo

fresh copy is available for

processing.

(Exported variables

are

init

when the program is first

activated in an activation group. They ret

assigned

value

on

a new call,

even

if LR was on for the previous

c

to re-initialize

them, you

have

to

reset them

manually.)

 

 

 

TIP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If you

are

accustomed

to

ending

with LR on to cause storage

to

and you are running in a

named

(persistent) activation group,

you

ma

consider

returning

without

an

end.

The

reasons

are:

 

 

¹The storage is not freed until the activation group ends so the

storage advantage to ending with LR on.

¹Call performance is improved if the program is not re-initialized call.

You

would only want to do this if you did not need your program

each

time.

Abnormal End

A

main

procedure

ends

abnormally and

control

returns to

the calling

pro

when one of

the

following occurs:

 

 

 

 

¹

The

cancel

option is

taken when an

ILE

RPG inquiry

message is

issu

¹An ENDSR *CANCL operation in a *PSSR or INFSR error subroutine is proc-

essed. (For further information on the *CANCL return point for the * INFSR error subroutines, see “Specifying a Return Point in the ENDSR Operation” on page 237).

¹An H1 through H9 indicator is on when a RETURN operation (with a

factor 2) is processed.

¹ An H1 through H9 indicator is on when last record (LR) processing the RPG cycle.

When a main procedure ends abnormally, the following occurs:

Chapter 10. Calling Programs and Procedures153

Page 177
Image 177
IBM AS/400 manual Abnormal End, Returning from a Called Program or Procedure