This application uses session input to:
As shown in Basic Program StructureFigure 253, the application is a small transaction processing program that takes name, price, and quantity as input items. As output, the application displays the total cost of the items that are specified on the screen and writes an audit trail of transactions to a file.
Figure 253. OPM CL Example: Basic Program Structure
As shown in Basic Program StructureFigure 253, this example consists of:
As shown in Figure 254, the CL, COBOL, and RPG programs are activated within the user default activation groups. A new activation group is started when the CL programs call the ILE C program because the ILE C program is created with the CRTPGM default of *NEW for the ACTGRP keyword.
Figure 254. Structure of the Program in ILE C
These programming steps show you how to:
CRTPF FILE(MYLIB/T1520DD2) SRCFILE(QCPPLE/QADDSSRC) MAXMBRS(*NOMAX)
This source file contains the audit trail for the ILE C program T1520IC5.
Figure 255. T1520DD2 -- DDS Source for an Audit File
|
CRTCLPGM PGM(MYLIB/T1520CL2) SRCFILE(QCPPLE/QACLSRC)
Figure 256. T1520CL2 -- CL Source to Pass Variables to an ILE C Program
|
Notes:
CRTCMD CMD(MYLIB/T1520CM2) PGM(MYLIB/T1520CL2) SRCFILE(QCPPLE/QACMDSRC)
Figure 257. T1520CM2 -- CL Command Source to Receive Input Data
|
CRTBNDC PGM(MYLIB/T1520IC5) SRCFILE(QCPPLE/QACSRC) OUTPUT(*PRINT) FLAG(30)
OPTION(*SHOWINC *NOLOGMSG) MSGLMT(10) CHECKOUT(*PARM) DBGVIEW(*ALL)
Figure 258. T1520IC5 -- ILE C Source to Call COBOL AND RPG
Notes:
CRTCBLPGM PGM(MYLIB/T1520CB1) SRCFILE(QCPPLE/QALBLSRC)
Figure 259. T1520CB1 -- OPM COBOL Source to Calculate Tax and Format Cost
|
Notes:
CRTRPGPGM PGM(MYLIB/T1520RP1) SRCFILE(QCPPLE/QARPGSRC) OPTION(*SOURCE *SECLVL)
Figure 260. T1520RP1 -- OPM RPG Source to Write the Audit Trail
|
Notes:
and press F4 (Prompt).
T1520CM2
Hammers
1.98
5000
Nails
0.25
2000
The output is as follows:
+--------------------------------------------------------------------------------+ | 5000 HAMMERS plus tax = $11,385.00 | | Press ENTER to end terminal session. | |> | | 2000 NAILS plus tax = $575.00 | | Press ENTER to end terminal session. | +--------------------------------------------------------------------------------+
The physical file T1520DD2 contains the data as follows:
SMITHE HAMMERS 0000000198500015 $11,385.00072893
SMITHE NAILS 0000000025200015 $575.00072893
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.