ILSMARTLINKAGE クラスでのプロパティ生成を非再定義の基本項目に制限します。
次の COBOL プログラムは、ILSMARTLINKAGE、ILSMARTRESTRICT、ILCUTPREFIX(lnk-b-)、および 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).
01 lnk-b-reprint-details redefines lnk-b-details.
03 lnk-b-invisible pic x(20).
procedure division using by value lnk-function
by reference lnk-b-details.
C# では、次のように .NET COBOL で BookLegacy プログラムのデータにアクセスできます。
BookLegacy myBook = new BookLegacy();
//creates an object corresponding to the BookLegacy program
Details myDetails = new Details();
//creates an instance corresponding to the group lnk-b-details
. . .
myDetails.Title = "Great Expectations";
myBook.BookLegacy("2", myDetails);
// calls the BookLegacy method with myDetails,
// which corresponds to the group item lnk-b-details
ILSMARTRESTRICT を設定せずに、グループ項目や再定義基本項目などの他のプロパティにアクセスできます。
... myDetails.setDetails = "Great Expectations Novel Dickens"; myDetails.setInvisible = "can't see this";
詳細については、Enterprise Developer サンプルの C# WinBook デモンストレーションを参照してください。