IBM AS/400 manual Problems when ILE CL Monitors for Notify and Status Messages

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 271
Image 271
119. Output from CANHDLR program

*-----------------------------------------------------------------

*Define the cancel handler. The parameter is a pointer to the

*'communication area', a message to be displayed.

 

*-----------------------------------------------------------------

 

 

P CanHdlr

B

 

 

D CanHdlr

PI

 

 

D

pMsg

 

*

 

 

*-----------------------------------------------------------------

 

 

 

* Define a field based on the input pointer pMsg.

 

*-----------------------------------------------------------------

 

 

D Msg

S

20A

BASED(pMsg)

 

*-----------------------------------------------------------------

 

 

*Display the message set by the procedure that enabled the￿

*handler.

 

*-----------------------------------------------------------------

 

 

C

'Cancel Hdlr 'DSPLY

Msg

P CanHdlr

E

 

 

 

 

 

 

 

Figure

118 (Part

4 of 4).

Enabling and Coding a Cancel Handler for a Subprocedure

The following is the output from program CANHDLR. Note that the *PSSR of procedure SubProc is called three times but the cancel handler is o because it was disabled before the third error.

DSPLY

Cancel Hdlr

Divide by zero

DSPLY

Subproc PSSR

 

DSPLY

Cancel Hdlr

String error

DSPLY

Subproc PSSR

 

DSPLY

Subproc PSSR

 

 

 

Figure

119. Output from CANHDLR program

Problems when ILE CL Monitors for Notify and Status Messages

If your ILE RPG procedure is called by an ILE CL procedure in th group, and the caller is monitoring for status or notify messages, th caller may get control prematurely because of a notify or status me ILE RPG procedure was trying to ignore.

For example, if the ILE RPG procedure writes a record to a printe actual printer file has a shorter record length that was declared dure, notify message CPF4906 is sent to the RPG procedure. The RPG e handling percolates this message which causes the default reply of message. This should allow the output operation to continue normally, an procedure should proceed to the next instruction.

However,

when the

ILE

CL

MONMSG

gets

control,

control passes

immediately

the

action

for

the MONMSG or the next statement

in

the

ILE

CL

proced

Note:

For

this

problem

 

to

occur,

the

procedure

monitoring

 

for

the

mes

 

not

have

to

be

the

immediate

caller

 

of

the

RPG

procedure.

This

problem

is

most

likely

to

occur

with

a

MONMSG

in

an

ILE

CL

caller,

also occur with other ILE languages

that

can

monitor

for

notify

and

sages, including

ILE

RPG using

ILE

condition

 

handlers

enabled

using

CEEHD

 

 

 

 

 

 

 

 

 

 

 

Chapter

12.

Handling

Exceptions247

 

 

 

Page 271
Image 271
IBM AS/400 manual Problems when ILE CL Monitors for Notify and Status Messages, Output from CANHDLR program