ILSMARTNEST

Use in conjunction with ILSMARTLINKAGE, to expose the Linkage Section items and entry points to managed code (such as C# or Java) as nested classes of the program class in which they are defined.
Restriction: This directive is supported for .NET COBOL, but not native COBOL.

Syntax:

>>-.---.-.----.-ILSMARTNEST------><
   +-\-+ +-NO-+

Properties:

Default: NOILSMARTNEST
Phase: Syntax check
$SET: Any
IDE Equivalent: Check Expose group linkage items to .NET code on the COBOL tab in the project's properties, click Options and check Expose as nested classes of the program class.

Comments:

By creating nested classes, programs within the same compilation unit can have linkage records with the same name.

Example:

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 C#, you can access the data in BookLegacy program in .NET 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-b-details 
    . . .          
       myDetails.Stockno = "6666";
       myDetails.Title = ".NET COBOL";
       myDetails.Author = "Mike Focus";
       myDetails.Type = "Reference";
       myDetails.Retail = 15.50M;
       myDetails.Onhand = 20;
       myDetails.Sold = 5;
       myBook.BookLegacy("2", myDetails);
         // calls the BookLegacy method with myDetails, 
         // which corresponds to the group item lnk-b-details
See the C# WinBook demonstration in the Visual COBOL samples for more.
Note: The C# program and form needs amending, to refer to BookLegacy.Details, when compiling with the ILSMARTNEST Compiler directive set.