Working with compile commands

About this task

The Work With Compile Commands dialog box helps you create or edit compile commands. When you create a new compile command, it appears in the Compile pop-up menu for remote resources. Each active profile can contain unique compile commands, and all applicable commands from all active profiles are displayed.

Procedure

  1. Open the Work with Compile Commands dialog. Right-click a source member and select Compile > Work with Compile Commands.
    Open dialog

    The dialog opens.

    Dialog open

  2. Create a command.
    1. In the Compile Commands list, select New command.
    2. Select a Source type. For example RPGLE. The command will be available for members that are of the source type that you choose.
    3. Type a name for the command in the Label field.
    4. Click Insert variable if you want to insert a substitution variable into the command. The values substituted for these variables change depending on the source member you select when you run the command. The following variables can be used:
      • &F: Name of the file containing the selected member
      • &L: Object or member library name
      • &N: Name of selected resource
      • &O: Object library (from Command Execution properties)
      • &R: Replace object when compiling: *YES or *NO (from Command Execution properties)
      • &X: Object or member text. Use single quotes.
    5. Click Create.

    New command created

    Note: If you are working with your own host command that directly calls an IBM compile command, there are additional steps that are necessary in order for the Error List view to be populated if the command is not successful:
    • In your command-processing program, ensure that the call to the IBM compile command includes the SRCMBR() and OPTION(*EVENTF) parameters.
    • In the Work with Compile Commands dialog, ensure that the command that you create also includes the SRCMBR() and OPTION(*EVENTF) parameters. The parameters can be specified within a comment at the end of the command. It is necessary to specify these parameters in the command you define in the dialog so that the Error List view is populated if the command is not successful.
    • For IFS non-batch commands, the compiler will check for PGM() or MODULE() parameters in the command string to determine the name of the generated events file.
  3. Run the command. After you create a command, it will appear in the Compile menu list when you right-click a source member of the source type that you created the command for. To run the command, right-click a source member and select Compile > Your command label. Note that if you want to work with additional options before running the command, select Compile (Prompt) > Your command label.
    New command in list
  4. View results. If the command runs successfully, a message will be displayed in the Commands Log view.
    Commands Log view with successful command

    If there are errors, a message may be displayed in the Commands Log view and errors listed in the Error List view. You can double-click an error to open it in the LPEX editor.

    Error List view

What to do next

If you want to edit an existing compile command, select the command in the list, change the label or command variable information, and click Apply.

Note that when you run a command, the Error List view is automatically populated if the command is not successful. See The Error List view for more information.