About this task
You can compile members in an
i Project, one or several at a time, either submitted to a batch job or compiled immediately.
When you compile, the default is that the workbench first pushes any changes
that have been made in the project to the
IBM® i server, and then compiles the members you have selected. You can change
the build and compile options in
i Project preferences. The two options that are available are
Push
all changed resources in the project (the default option), and
Push
selected resource if there are any changes.
To compile a
single member:- Expand your i Project until
you see the member that you want to compile.
- Right-click, select Remote Actions, and then select
from one of:
- Compile to compile the member without prompt. The
member is compiled using the current compile command for its source type.
- Compile(Prompt) to compile the member with prompt,
that is, to specify extra parameters.
- Select Compile Command to make a certain command
the current one for this source type.
- Work With Compile Commands to add, change, or delete
associated compile commands.
To compile multiple members:- Expand your i Project until
you see the members that you want to compile.
- Select the members by holding down the Ctrl key and clicking each member.
- Right-click, select Remote Actions, and then select
from one of:
- Compile to submit a compile command for each selected
member according to the order based on their type. (This order can be changed
through the preferences as mentioned below. See Modifying compile order
preferences at the bottom of this page.) The members are then compiled
using the current compile command for their source type.
- Work With Compile Commands to add, change, or delete
associated compile commands.
What to do next
Batch versus immediate mode:
- If you compile in batch mode, all selected members are compiled in a single
batch job. The progress of the submitted job displays in the Job Status view.
- If you compile in batch mode and you use OPTION(*EVENTF) in your compile
commands, the compile errors are gathered in a combined event file that you
can retrieve after the action is performed. You can retrieve the compiler
errors by right-clicking the job identifier in the Job Status view and selecting .
- If you compile in immediate mode, then the compile commands are submitted
serially. Any compile errors are shown in a separate tab for each member in
the error list.
You can modify the batch versus immediate preference using the Build
Style preference page. Click from the workbench menu. Then expand
i
Projects and select
Build and Compile. Note the
check box for
Run compiles as batch jobs. If selected,
compiles from
i Projects are
submitted in a batch job. If deselected, compiles are run in immediate mode.
Modifying
compile order preferences:
When you compile more than one source
member at a time, the order in which the source members are compiled follows
the member type ordering in the IBM i Command Execution preference page. To access this preference page,
click from the workbench menu. Then expand and click Command Execution. In the Compile
member types in this order area, you can select various member
types and move them up or down in the hierarchy list.
Customizing
project builds that use the CL Program build style:
To submit a
build after COMPILE.CLLE member is manually generated or
edited, right click the project, then click . The COMPILE.CLLE member
is compiled and, if it exists, the BIND.CLLE member is compiled
as well. The COMPILE program is then run. The BIND program, if it exists,
is run after the COMPILE program, but only if there are no compile errors
found during the run of the COMPILE program. This is determined by looking
at the value of the QRB_NUMBER_FAILED environment variable.
To force the BIND program to run even if there are compile errors, you can
set this environment variable to 0 at the end of the COMPILE
program or just remove the statements that update it.
Creating or changing
files presents a problem because there is no *REPLACE parameter
on the create file commands. These may require a customized build procedure.
Users can modify COMPILE.CLLE to either delete generated
files prior to recreating them, or use a CHKOBJ test to run
a different command (for example, CHGPF instead of CRTPF).
Logical files built over these physical files may prevent arbitrary changes
so they may have to be deleted first.
If the physical files hold data,
then users may have to take special precaution to preserve that data. One
way is to rename the old file, then copy its contents back into the generated
file, mapping the fields during the copy.
Note: It is recommended that
physical files, logical files, and program files are separated into their
own projects to allow them to be built separately. All projects can be assigned
to the same associated library.
If you write a customized COMPILE.CLLE,
make sure you turn off the automatic generation of it for that project in
the project's properties.