Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

COBCH1722 or COBCH1723 compile error in managed COBOL application

COBCH1722 or COBCH1723 compile error in managed COBOL application

Problem:

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.

Resolution:

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.

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2015-05-13 14:08
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.