Defining Compile Rules

To tell BS2IDE which Compile Command should be applied to which type of source you must create a Compile Rule. Here you can define the Source Pattern to declare the type of source. To be able to interpret the listing generated by the compiler and to set problem markers on the source file, BS2IDE must also know where to find the generated listing. This can be configured in Listing Expression. For your convenience it is also possible to assign a Placeholder Set. Therewith you can define one or more placeholders that can be used in the Compile Command. (see Defining Placeholder Sets).

Compile Rules can be configured in Preference Pages,see below.

Preference Page

To define compile rules open command link Window > Preferences > BS2000 Remote IDE > Remote Compilation. Here is the default contents of the Remote Compilation preference page:

Compile rules

In the lower half of the Remote Compilation preference page you specify Compile rules. You can add new rules by clicking Add Rule, edit a selected rule by clicking Edit Rule, or deleting a selected rule by clicking Delete Rule. For the sake of convenience, if a Compile rule is selected when Add Rule is clicked, the selected rule is shown as initial value in the the dialog box which is opened to enter the new rule.

A Compile rule consists of the following parts:

Compile Rule Name The name of the rule. Names need not be unique, but it is recommended to use the same name only for rules with disjunctive source patterns (e.g. one for single files, the other for library elements). The name of the rule will be listed in the sub-menu of the context menu Remote Compile With.
Source File Type Specifies whether this rule is to be applied to Simple files, PLAM library elements, or to All files. If All files is specified the rule is applied in any case, whether a simple file or a library element is selected.
Source Pattern Specifies a pattern for the source file or library element path.
Paths of simple files match the general pattern :cat:$user.filename,
paths of library elements of the *HIGHEST-EXISTING version match the general pattern :cat:$user.libname/type/element,
and paths of library elements of other versions match the general pattern :cat:$user.libname/type/element()/element(version).
Wildcards (*) and herewith user-defined placeholders of the form &{placeholder-name} are allowed in patterns. A placeholder behaves like a wildcard, but during pattern matching with a source path the matching substring is assigned to this placeholder.
Source pattern not specifying a cat ID and/or user ID and not beginning with a wildcard or a placeholder are implicitly prefixed with :*: or :*:$*., resp.
Note that using more than one placeholder may lead to ambiguous assignment.
Sample 1: The file name :cid:$uid.pre1.prog1.cbl matches the source pattern :*:$*.&{prefix}.&{program}.CBL and defines the placeholder &{prefix} with value pre1 and &{program} with value prog1.
Sample 2: The source pattern * matches all file names. With this source pattern the compile rule can be applied to all file names.
For further examples of source patterns see screenshot above.
Source files must not be ISAM files.
Listing Expression Specifies where the invoked compiler will generate the listing. This expression can contain placeholders previously defined in the Source Pattern as well as some generic placeholders derived from the matching source file or library element, see Generic Placeholders.
The button Add Placeholders... provides a convenient method to insert available placeholders in listing expressions.
For examples of listing expressions see screenshot above.
Listing files must not be stored on private disks.
Placeholder Set From the dropdown box you can choose one of the predefined Placeholder Sets. The placeholder defined in this set can be used in the Compile Command
Compile Command Specifies the compile command (by its Command Name) to be executed when this rule is active. The compile command may refer to the placeholders defined in the Source Pattern or to generic placeholders or to placeholders defined in the selected Placeholder Set.
Several rules can specify the same compile command. Thus you can assign a first compile command cmd1 to a first set of libraries (e.g. *.lib1/s/* and *.lib2/s/*, each having its own Compile rule but specifying the same Command name cmd1) and second compile command cmd2 to another set of libraries (e.g. *.lib3/s/ and *.lib4/s/* specifying cmd2 as compile command).
A convenient way to edit the compile command associated with a selected compile rule is to press the Edit Command button.
Output files expressions Specifies where the invoked compiler will generate the output file(s) that will be downloaded after compilation. After compilation, BS2IDE will search for defined Delegate Rules that matched provided Output file expression in given project and replace it's content with the remote file from BS2000 host.
This expression can contain placeholders previously defined in the Source Pattern as well as some generic placeholders derived from the matching source file or library element, see Generic Placeholders.

Defining Output file expression is similar to the listing expression.
Output files must not be stored on private disks.
When no Delegate Rule is defined in project that matches expression then Output file will not be downloaded.

Debugging your compile commands and rules

When you start remote compilation (see Starting Remote Compilation) the values of the placeholders, the selected compile command, the final compile command after replacement of placeholders and the output of the command are logged in the Console view (to be opened via command link Window > Show View > Other... > General > Console). This is very helpful for debugging your commands and rules.

A convenient way to open the listing file generated by a remote compilation is the context menu BS2000 > Open Remote Listing File of the source file, or just press Ctrl+Alt+L.

Furthermore you can open the Remote BS2000 Compilations view via command link Window > Show View > Other... > BS2000 > Remote BS2000 Compilations. If an entry in this view is selected (by clicking on its Date/Time field) the view menu provides Open Listing File and Show Console Output. The console output is only available during the current Eclipse session, it is not persistently saved.