IBM AS/400 Frozen Dessert Maker User Manual


 
Note that the File specification for PRDMAS identifies both the INFDS and identifies
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 using the trans-
action product number.
2. If the record is found, then the quantity of the inventory is updated.
3. If an error occurs on the UPDATE operation, then control is passed to the
INFSR error subroutine.
4. If the record is not found, then the product number is written to an error report.
*=================================================================*
* TRNSUPDT: This program is a simple inventory update program. *
* The transaction file (TRANSACT) is processed consecutively. *
* The product number in the transaction is used as key to access *
* the master file (PRDMAS) randomly. *
* 1. If the record is found, the quantity of the inventory will *
* 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 PRDMAS. *
* 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