In the InterfacingWithStdCOBOL.sln solution, the third pair of projects, StdCbl03*, shows a COBOL program using occurs clauses. In the same way as the StdCbl02 projects, this project uses a proxy class to manipulate the COBOL data to and from object properties, so that these properties are exposed to the C# client.
The StdCbl03 projects contain the following programs:
Lines 11-16:
01 INOUT-FIELDS.
  03 INOUT-FIELD01                PIC  9(02)       COMP.
  03 INOUT-FIELD02                PIC  X(26). 
  03 INOUT-TABLE          OCCURS 3.
    05 INOUT-TABLE-FIELD01        PIC  X(15). 
    05 INOUT-TABLE-FIELD02        PIC    S9(09)V9(5)  COMP-3.       
                  		  We can view this occurs group as if it had three occurrences of two fields or an array of size three where each position in the array has two fields or properties. If each occurrence is an object with two properties, you can code it neatly as a .NET ArrayList.
Lines 7-33
    *> OO COBOL class for OUT-TABLE table
 class-id. OOiOutFields.
 working-storage section.
    *> using native .NET Type and/or classes
 01 OutTableField01      type System.Double property.
 01 OutTableField02      type System.Double property.
       
 end class. 
                  		Line 31 in the Working Storage section of the method ExecStdCbl03:
01 obj-InoutFieldsItem type OOiInoutFields
Line 59 in the Linkage section:
01 obj-InoutFieldsArray Object Reference ArrayListClass.
Line 36:
procedure division using obj-InoutFieldsArray as type System.Collections.ArrayList
                         obj-OutFieldsArray   as type System.Collections.ArrayList. 
                        			 Lines 47-51:
Move 1 to Idx
Perform varying obj-InoutFieldsItem through obj-InoutFieldsArray
			 Set INOUT-TABLE-FIELD01(Idx) to 
                       obj-InoutFieldsItem::"InOutTableField01"
    Move obj-InoutFieldsItem::"InOutTableField02" to 
                       INOUT-TABLE-FIELD02(Idx)
			 Add 1 to Idx	 
	End-Perform   
                        				The ArrayList now contains three objects each with two properties. It contains the equivalent of three occurrences of two fields in an occurs group.
Line 53:
Call "StdCbl03"									
         using INPUT-FIELDS INOUT-FIELDS OUTPUT-FIELDS 
                        			 Lines 31:
ArrayList InOutArray = new ArrayList(3);
Lines 36-39:
OOiInoutFields inOutFieldsItem0 = new OOiInoutFields(); inOutFieldsItem0.InOutTableField01 = "Item #1"; inOutFieldsItem0.InOutTableField02 = 111.111; InOutArray.Add(inOutFieldsItem0);
Line 55:
objStdCbl03.ExecStdCbl03(ref InOutArray, ref OutArray );
The result is a .NET ArrayList (or more precisely System.Collections.ArrayList) that you can pass to and from C# or any .NET managed code. You can work with it in many ways, including binding it to a DataGrid.