COBCH1722 or COBCH1723 compile error in managed COBOL application



When you have a COBOL array defined in a COBOL class and expose all the array items as properties like below:

class-id squarebrackets.Class1.

working-storage section.

01 cob-array property all.

   05 my-occurs occurs 3 times.

      10 my-field pic x.      

end class.

And you reference the array item in your managed COBOL program using square brackets and provide a index number like below:

"type Class1::my-field" if the property is a static property.

"myobject::my-field" if the property is an instance property.

You will get the COBCH1722 or COBCH1723 compile error when building the application.


The [] syntax can be used in two situations:

1) For indexing an array (with zero based indexes)

2) For passing parameters to an indexer, defined on the type of the item.  e.g. the indexer for the List type in .NET (System.Collections.Generic.List) expects an int parameter n and returns the n'th element of the list.

Although Class1::my-field looks like an array, it is in fact a 'property with parameters' (this is how we implement OCCURS item exposed as property) and therefore the [] style syntax is not applicable.  See documentation for ILARRAYPROPERTY for more information on this.

Comment List
  • I ran into this problem in a slightly different way.  All of a sudden, the array that is one-based in COBOL is zero-based as a property.  Not sure why this should be but it screws up my processing.  I ended up implementing the Get and reading the array in the class to make it one-based again.

Related Discussions