>>-.---.-.-------ILSMARTLINKAGE---.-------------.--.-------->< +-/-+ | +-"namespace"-+ | +-----NOILSMARTLINKAGE--------------------+
The following COBOL program is compiled with ILSMARTLINKAGE, ILCUTPREFIX(lnk-b-) and ILCUTPREFIX(lnk-):
program-id. BookLegacy. ... linkage section. 01 lnk-function pic x. 01 lnk-b-details. 03 lnk-b-text-details. 05 lnk-b-title pic x(50). 05 lnk-b-type pic x(20). 05 lnk-b-author pic x(50). 03 lnk-b-stockno pic x(4). 03 lnk-b-retail pic 99v99. 03 lnk-b-onhand pic 9(5). procedure division using by value lnk-function by reference lnk-b-details.
In Java, you can access the data in BookLegacy program in JVM managed COBOL as follows:
BookLegacy myBook = new BookLegacy(); //creates an object corresponding to the BookLegacy program Details myDetails = new Details(); //creates an instance corresponding to the group lnk-bdetails . . . myDetails.setStockno("6666"); myDetails.setTitle("Managed COBOL"); myDetails.setAuthor("Mike Focus"); myDetails.setType("Reference"); myDetails.setRetail(new ScaledInteger(155, 5)); myDetails.setOnhand(20);
Comments:
This directive exposes group linkage items to managed code. In addition to the class generated as usual for the COBOL program, this directive effectively generates one class for every 01 level group item in the linkage section. Each data item in the group is exposed as a property of this class, where the property is of a standard managed type. Subordinate groups are exposed as strings.
Hyphens are removed from data item names and the letter following a removed hyphen is folded to upper case. For example a data item author-name is renamed to AuthorName.
If a namespace is specified, all classes generated as a result of this directive are grouped under that namespace.