How do I go through the collection?
I am in the trial version of the Fujitsu / Alchemy compiler and get slow and poor support from the provider.
I basically want to pass List from C # to COBOL, and then let COBOL use it and possibly update it.
In C #, the usual way to iterate through a collection is to use the "foreach" construct.
However, the C # "foreach" construct is a shortcut to the following:
private static void test1() { List<IDMSMapField> list1 = new List<IDMSMapField>(); int listSize = list1.Count;
I can write this in COBOL if you can help me figure it out to declare this class:
System.Collections.Generic.List<IDMSMapField>.Enumerator
The Enumerator structure is documented on the Microsoft MSDN site .
It says that "Enumerator" is a Struct, not a class!
From what I can say in the guide "CreateCOBOLfromDotnetFrameworkDox.pdf", structures are defined as classes in COBOL REGISTRATION.
Example from the manual:
Define specifiers for structure in REPOSITORY, and any struct members: CLASS STRUCT-name AS "struct-namespace" PROPERTY PROP-struct-member AS "external-property-name" Handle structures like classes. Eg object to store a struct instance: 01 struct-object OBJECT REFERENCE STRUCT-name.
Below I repeat some of the options that I tried, which all failed to compile, due to an "impossible to solve" error. If you can show me how to make this clear, I think we can move forward.
1.
REPOSITORY. CLASS CLASS-LIST AS "System.Collections.Generic.List<>" CLASS STRUCT-Enumerator AS "System.Collections.Generic.List<>.Enumerator" .
The error in the second line:
error JMN1795I-S: Named reference 'System.Collections.Generic.List <>. Enumerator 'cannot be resolved.
JMN1795I-S error: The named link "System.Collections.Generic.List.Enumerator" cannot be resolved.
JMN1795I-S error: The named link "System.Collections.Generic.List.Enumerator" cannot be resolved.
Another option is to consider it as an array, but I am also fixated on this.
REPOSITORY. CLASS LIST-IDMSMapField AS "System.Collections.Generic.List<>[]" CLASS CLASS-IDMSMapField AS "Lightyear.ERCB.IDMSDC.IDMSMapField" CLASS CLASS-LIST-IDMSMapField EXPANDS LIST-IDMSMapField USING CLASS-IDMSMapField. METHOD-ID. TW1DR4000-PF06 AS "TW1DR4000_PF06". DATA DIVISION. WORKING-STORAGE SECTION. 01 MapFieldItem USAGE OBJECT REFERENCE CLASS-IDMSMapField. LINKAGE SECTION. 01 MapFieldList USAGE OBJECT REFERENCE CLASS-LIST-IDMSMapField. PROCEDURE DIVISION... ... SET MapFieldItem TO MapFieldList(1).
error JMN2671I-S: ':' must be specified in the link modifier. ':' is assumed.
I think the compiler sees (1) as a substring operation.