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.
You can use the CRTSQLCI or CRTSQLCPPI command to start the ILE C compiler and create a program object. The SQL database can be accessed from an ILE C/C++ program if you embed SQL statements in the ILE C/C++ source.
Example:
CRTBNDC PGM(MYLIB/T1520ALP) SRCFILE(QCPPLE/QACSRC)
TEXT('Adds integers and prints characters') OUTPUT(*PRINT)
OPTION(*SHOWINC *NOLOGMSG) FLAG(30) MSGLMT(10)
CHECKOUT(*PARM) DBGVIEW(*ALL)
The options specified are:
Select an option to see the compiler listing.
CALL PGM(MYLIB/T1520ALP)
The interactive session is as shown:
+--------------------------------------------------------------------------------+ | > a | | > 9 | | > b | | > 8 | | > + | | Characters are ab | | Sum of Digits is 17 | | Press ENTER to end terminal session. | +--------------------------------------------------------------------------------+
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.