Creating a Program in One Step - IBM-ILE

You can use the CRTBNDC and CRTBNDCPP Create Bound Program commands to create a program (*PGM object) in one step.

The Create Bound Program commands combine the steps of compiling and binding. Using them is the same as first calling the CRTCMOD or CRTCPPMOD Create Module command, then calling the Create Program (CRTPGM) command, except that the module created by the Create Module command step is deleted after the CRTPGM step.

To use the Create Bound Program commands, the source member must contain a main() function.

Note: When a CRTPGM parameter does not appear in the Create Bound Program command, the CRTPGM parameter default is used. For example, the parameter ACTGRP(*NEW) is the default for the CRTPGM command, and is used for the Create Bound Program command. You can change the CRTPGM parameter defaults by using the Change Command Defaults (CHGCMDDFT) command.

You can use the CRTSQLCI command to start the ILE C compiler and create a program object. The SQL database can be accessed from an ILE C program if you embed SQL statements in the ILE C source.

Example

  1. To create the program T1520ALP, using the source found in Figure, type the following command line:
  2. CRTBNDC PGM(MYLIB/T1520ALP) SRCFILE(QCPPLE/QACSRC)
    TEXT(’Adds integers and prints characters’) OUTPUT(*PRINT)
    OPTION(*EXPMAC *SHOWINC *NOLOGMSG) FLAG(30) MSGLMT(10)
    CHECKOUT(*PARM) DBGVIEW(*ALL)

    The options specified are:

    • OUTPUT(*PRINT) - specifies that you want a compiler listing.
    • OPTION(*EXPMAC *SHOWINC *NOLOGMSG) - specifies that you want to expand include files and macros in a compiler listing and not log messages in the job log.
    • FLAG(30) - specifies that you want severity level 30 messages to appear in the listing.
    • MSGLMT(10) — specifies that you want compilation to stop after 11 messages at severity level 30.
    • CHECKOUT(*PARM) — shows a list of function parameters not used. DBGVIEW(*ALL) specifies that you want all three views and debug data to debug this program.

    CLE, the program attribute, identifies this program as an Integrated Language Environment program.

  3. Type one of the following CL commands to see the compiler listing:
    • DSPJOB and then select option 4 (Display spooled files)
    • WRKJOB and then select option 4 (Work with spooled files)
    • WRKOUTQ queue-name
    • WRKSPLF
  4. Select an option to see the compiler listing.

  5. To run the program type:
  6. CALL PGM(MYLIB/T1520ALP)
  7. Type a and press Enter. Type 9 and press Enter. Type b and press Enter. Type 8 and press Enter. Type + and press Enter. The interactive session is as shown:

The interactive session

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IBM-ILE Topics