>>-.---.-.----.-ILSMARTNEST------>< +-\-+ +-NO-+
Default: | NOILSMARTNEST |
Phase: | Syntax check |
$SET: | Any |
IDE Equivalent: | None |
By creating nested classes, programs within the same compilation unit can have linkage records with the same name.
The following COBOL program is compiled with ILSMARTLINKAGE, ILSMARTNEST, 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). 03 lnk-b-sold 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 COBOL as follows:
BookLegacy myBook = new BookLegacy();
//creates an object corresponding to the BookLegacy program
BookLegacy.Details myDetails = new BookLegacy.Details();
//creates an instance corresponding to the group lnk-bdetails
. . .
myDetails.setStockno("6666");
myDetails.setTitle("JVM COBOL");
myDetails.setAuthor("Mike Focus");
myDetails.setType("Reference");
myDetails.setRetail(BigDecimal.valueOf(155, 5));
myDetails.setOnhand(20);