Placeholders, arrays, and nested arrays
You can implement methods in the BOM using COBOL code and placeholders. You use placeholders to keep a place for a COBOL field whose name can vary, or for more complex logic.
The COBOL code generation feature
is deprecated in V8.5. This feature will be removed in a future release
of the product. Use the COBOL Generation Project Migration wizard
to migrate your Rules for COBOL project to a zRule
Execution Server for z/OS® compatible
rule project. See Deprecated features for migration
details.
When you implement a method, you can use the following placeholders:
The {} placeholder, to represent the COBOL expression of variables
The <> placeholder, to represent the generated COBOL data item of variables
For example, if you have the following copybook:
01 COMPANY.
05 NAME PIC X(20).
05 SYMBOL PIC X(8).
05 EMPLOYEE OCCURS 50 TIMES.
10 EMPNUMBER PIC 9(5).
The imported copybook creates two classes in the BOM, Company and Employee. You can create the following method for the Company class:
public void hasEmployee(Employee emp)
To implement this method, you can use the {} placeholder to refer to the COBOL expression for the method parameter. For example:
{this} for the current company object
{emp} for the Employee argument, where {emp} refers to an employee item in the EMPLOYEE OF COMPANY table
For Boolean values, the COBOL code generator creates a Level 88 data item:
02 RETURN-TEMP PIC X.
88 BOOLVALUE VALUE 'T'.
Here, RETURN-TEMP is a Level 88 data item created for the return value.
The following examples show how the <> and the {} placeholders are used for a boolean type:
To set the method return value as true, you can write methods such as: MOVE ‘T' TO <return>, or SET {return} to TRUE
To set the method return value as false: MOVE ‘F' TO <return>
To test if a value is true: IF {return} THEN
For a detailed example of how COBOL methods can use placeholders and arrays, see Example: Using placeholders, arrays and nested arrays.