Creating an OPM-Compatible Program Object

In this example you use the CRTBNDRPG command to create an OPM-compatible program object from the source for the payroll program, shown in Figure 33.

  1. To create the object, type:
    CRTBNDRPG PGM(MYLIB/PAYROLL)
              SRCFILE(MYLIB/QRPGLESRC)
              TEXT('ILE RPG program')  DFTACTGRP(*YES)

    The CRTBNDRPG command creates the program PAYROLL in MYLIB, which will run in the default activation group. By default, a compiler listing is produced.

    Note:
    The setting of DFTACTGRP(*YES) is what provides the OPM compatibility. This setting also prevents you from entering a value for the ACTGRP and BNDDIR parameters. Furthermore, if the source contains any bound procedure calls, an error is issued and the compilation ends.
  2. Type one of the following CL commands to see the listing that is created:
Figure 33. A Sample Payroll Calculation Program
 *------------------------------------------------------------------------*
 * DESCRIPTION:  This program creates a printed output of employee's pay  *
 *               for the week.                                            *
 *------------------------------------------------------------------------*
H DATEDIT(*DMY/)
 *------------------------------------------------------------------------*
 * File Definitions                                                       *
 *------------------------------------------------------------------------*
FTRANSACT  IP   E           K DISK
FEMPLOYEE  IF   E           K DISK
FQSYSPRT   O    F   80        PRINTER
 *------------------------------------------------------------------------*
 * Variable Declarations                                                  *
 *------------------------------------------------------------------------*
D Pay             S              8P 2
 *------------------------------------------------------------------------*
 * Constant Declarations                                                  *
 *------------------------------------------------------------------------*

D Heading1        C                   'NUMBER  NAME              RATE    H-
D                                     OURS  BONUS    PAY       '
D Heading2        C                   '______  ________________  ______  _-
D                                     ____  _______  __________'
 *------------------------------------------------------------------------*
 * For each record in the transaction file (TRANSACT), if the employee    *
 * is found, compute the employees pay and print the details.             *
 *------------------------------------------------------------------------*
C     TRN_NUMBER    CHAIN     EMP_REC                            99
C                   IF        NOT *IN99
C                   EVAL (H)  Pay = EMP_RATE * TRN_HOURS + TRN_BONUS
C                   ENDIF
 *------------------------------------------------------------------------*
 * Report Layout                                                          *
 *  -- print the heading lines if 1P is on                                *
 *  -- if the record is found (indicator 99 is off) print the payroll     *
 *     details otherwise print an exception record                        *
 *  -- print 'END OF LISTING' when LR is on                               *
 *------------------------------------------------------------------------*
OQSYSPRT   H    1P                     2  3
O                                           35 'PAYROLL REGISTER'
O                       *DATE         Y     60
O          H    1P                     2
O                                           60 Heading1
O          H    1P                     2
O                                           60 Heading2
O          D   N1PN99                  2
O                       TRN_NUMBER           5
O                       EMP_NAME            24
O                       EMP_RATE      L     33
O                       TRN_HOURS     L     40
O                       TRN_BONUS     L     49
O                       Pay                 60 '$     0.  '
O          D   N1P 99                  2
O                       TRN_NUMBER           5
O                                           35 '** NOT ON EMPLOYEE FILE **'
O          T    LR
O                                           33 'END OF LISTING'


[ Top of Page | Previous Page | Next Page | Contents | Index ]