IBM AS/400 Frozen Dessert Maker User Manual


 
Creating a Module Object
*=================================================================*
* MODULE NAME: TRANSRPT
* RELATED FILES: TRNSDTA (PF)
* RELATED SOURCE: TRANSSVC (Transaction services)
* EXPORTED PROCEDURE: TRANSRPT
* The procedure TRANSRPT reads every tranasction record
* stored in the physical file TRNSDTA. It calls the
* subprocedure Trans_Inc which performs calculations and
* returns a value back. Then it calls Prod_Name to
* to determine the product name. TRANSRPT then prints
* the transaction record out.
*=================================================================*
FTRNSDTA IP E DISK
FQSYSPRT O F 80 PRINTER OFLIND(*INOF)
/COPY QRPGLE,TRANSP
* Define the readable version of the product name like the
* return value of the procedure 'Prod_Name'
D ProdName S 30A
D Income S 10P 2
D Total S +5 LIKE(Income)
*
ITRNSREC 01
* Calculate the income using subprocedure Trans_Inc
C EVAL Income = Trans_Inc(PROD : QTY : DISC)
C EVAL Total = Total + Income
* Find the name of the product
C EVAL ProdName = Prod_Name(PROD)
OQSYSPRT H 1P 1
O OR OF
O 12 'Product name'
O 40 'Quantity'
O 54 'Income'
OQSYSPRT H 1P 1
O OR OF
O 30 '----------+
O ----------+
O ----------'
O 40 '--------'
O 60 '------------'
OQSYSPRT D 01 1
O ProdName 30
O QTY 1 40
O Income 1 60
OQSYSPRT T LR 1
O 'Total: '
O Total 1
Figure 38. Source for TRANSRPT module
The DDS for the file TRNSDTA is shown in Figure 39 on page 80. The /COPY
member is shown in Figure 37 on page 78.
Chapter 7. Creating a Program with the CRTRPGMOD and CRTPGM Commands 79