IBM AS/400 manual Access the product master file using the transaction product, number, Endsr

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 255
Image 255
* Access the product master file using the transaction pro￿duct

 

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

 

*

 

* Access the product master file using the transaction pro￿duct

*

 

* number.

 

 

*

 

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

 

*

C

TRNPRDNO

CHAIN

PRDREC

10

 

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

 

*

* If the record is found, update the quantity in the master f￿ile. *

 

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

 

 

*

C

 

IF

NOT *IN10

 

 

C

 

SUB

TRNQTY

PRDQTY

 

C

 

UPDATE

PRDREC

 

 

 

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

 

 

*

 

* If the record is not found, write to the error report

*

 

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

 

 

*

C

 

ELSE

 

 

 

C

 

EXCEPT

NOTFOUND

 

 

C

 

ENDIF

 

 

 

C

 

SETON

 

 

LR

 

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

 

 

*

 

* Error handling routine.

 

 

*

 

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

 

 

*

C

PrdInfsr

BEGSR

 

 

 

 

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

 

 

*

* If the master record is currently locked, write the trans￿action *

* record to the back log file and skip to next transaction.

*

*

-----------------------------------------------------------------

 

 

*

C

PrdStatus

DSPLY

 

 

 

C

 

IF

(PrdStatus = ErrRecLock)

 

C

 

WRITE

TRNBREC

 

 

C

 

MOVE

'*GETIN'

ReturnPt

6

*

-----------------------------------------------------------------

 

 

*

* If unexpected error occurs, cause inquiry message to be i￿ssued. *

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

 

 

*

C

 

ELSE

 

 

C

 

MOVE

*BLANK

ReturnPt

C

 

ENDIF

 

 

C

 

ENDSR

ReturnPt

 

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

 

 

*

* Error report format.

 

*

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

 

 

*

OPRINT

E

NOTFOUND

 

O

 

TRNPRDNO

 

O

 

 

 

29 'NOT IN PRDMAS FILE'

 

 

 

 

Figure 111

(Part

2 of

2). Example of File Exception Handling

When control is passed to the error subroutine, the following occurs:

¹

If

the

error

is

due

to

a

record

lock, then

the

record is

wri

 

and

control

returns

to

the

main

part

with

the

next

transaction

(vi

 

the

return

point).

 

 

 

 

 

 

 

 

 

 

¹

If

the

error

is

due

to

some

other

reason,

then

blanks are

moved

 

This

will

result

in

the RPG default handler receiving control. The

 

at

that

point

will

depend

on

the nature

of the error.

 

Note

that

the

check

for

a

record

lock

error is done by matching t

field of

the

INFDS

for

PRDMAS

against

the

field

ErrRecLock which

is

the

value

of the record lock status code.

The

INFSR

could be

exte

other types of I/O errors by defining

other

errors,

checking

for

taking

an

appropriate

action.

 

 

 

 

 

 

 

 

 

 

 

 

 

Chapter

12.

Handling Exceptions231

 

Page 255
Image 255
IBM AS/400 manual Access the product master file using the transaction product, number, Endsr