IBM AS/400 manual TRNSUPDT This program is a simple inventory update program

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 254
Image 254

Note

that

the

File specification

for PRDMAS identifies both the INFDS a

the

INFSR

to

be associated with

it.

The following is done for each record in the TRANSACT file:

1.The appropriate record in the product master file is located usin action product number.

2. If

the

record is found, then the quantity

of the inventory is u

3. If

an

error occurs on the UPDATE operation,

then control is passed

INFSR

error subroutine.

 

4. If the record is not found, then the product number is written

*=================================================================*

* TRNSUPDT: This program is a simple inventory update progr￿am.

*

* The transaction file (TRANSACT) is processed consecutive￿ly.

*

* The product number in the transaction is used as key to ac￿cess

*

* the master file (PRDMAS) randomly.

*

* 1. If the record is found, the quantity of the inventory wil￿l

*

*

be updated.

 

 

*

* 2. If the record is not found, an error will be printed on a

*

*

report.

 

 

 

*

* 3. If the record is currently locked, the transaction will￿ be

*

*

written to a transaction back log file which will be

*

*

processed later.

 

*

* 4. Any other unexpected error will cause a runtime error

*

*

message.

 

 

 

*

*=================================================================*

*

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

 

 

 

*

* Define the files:

 

*

*

1) PRDMAS

 

- Product master file

*

*

2) TRANSACT

 

- Transaction file

*

*

3) TRNBACKLG

- Transaction backlog file

*

*

2) PRINT

 

- Error report.

*

*

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

 

 

 

*

FPRDMAS

UF

E

 

K DISK

 

F

 

 

 

 

INFSR(PrdInfsr)

 

F

 

 

 

 

INFDS(PrdInfds)

 

FTRANSACT

IP

E

 

DISK

 

FTRNBACKLG O

E

 

DISK

 

FPRINT

O

F

80

PRINTER

 

*

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

 

 

 

*

* Define the file information data structure for file PRDM￿AS.

*

* The *STATUS field is used to determine what action to take￿.

*

*

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

 

 

 

*

D PrdInfds

 

DS

 

 

D

PrdStatus

 

*STATUS

 

*

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

 

 

 

*

* List of expected exceptions.

*

*

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

 

 

 

*

D ErrRecLock

 

C

CONST(1218)

 

 

 

 

 

 

 

 

Figure

111

(Part

 

1 of

2). Example of File Exception Handling

 

230 ILE RPG for AS/400 Programmer's Guide

Page 254
Image 254
IBM AS/400 manual TRNSUPDT This program is a simple inventory update program