COBOL methods
The generated COBOL program uses methods to exchange data with the COBOL calling program, or to carry out special execution or processing either before or after rule execution.
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 generate a BOM, the BOM contains classes, and the classes have fields (attributes), but classes have no methods. For COBOL code generation you must add them manually.
You use methods to specify conditions and actions in your rules. For example, you might want to calculate the difference between two dates where the answer to the date calculation affects which rules execute or which rule conditions are met. BOM methods operate on the parameters and return values.
When you add a method, you must also implement it in COBOL if you intend to execute your rules using a generated COBOL program. You need this implementation so that the generated COBOL program can call the method. The generated COBOL program uses methods to exchange data with the COBOL calling program, and to carry out special execution or processing either before or after rule execution.
You do not implement the BOM methods in COBOL if you intend to deploy to zRule Execution Server for z/OS for rule execution.
You can implement either macro or mapped methods for COBOL:
Implement a macro method if you want an inline COBOL statement, such as ITEM_A > ITEM_B or ITEM_A IS NUMERIC. You can define only a single COBOL statement for a macro method.
Implement a mapped method if the method requires a set of COBOL statements. For example:
IF SCORE OF EMPLOYEE < 100 THEN MOVE 1 TO RETURNTEMP END-IF
You can implement COBOL methods using a combination of COBOL code and placeholders. You use placeholders, for example, to keep a place for a COBOL field whose name varies, or for more complex logic. COBOL code generator replaces the placeholder with its matching COBOL code when you generate the COBOL code for rule execution.
You can use the {} placeholder to refer to a COBOL expression. For example:
{arg0}, {arg1}, {arg2} for parameter expressions; {arg0} is a variable name
{return} for return value expressions
{this} for a current BOM object that contains methods
You can also use the <> placeholder to refer to automatically generated COBOL data items. You can use the <> placeholder only in mapped methods, not in macro methods. See Placeholders, arrays, and nested arrays.