Resolved Nested Classes with Arrays.

RobertbNZ

Active member
Joined
Jun 26, 2020
Messages
37
Programming Experience
Beginner
In Nested Classes Skydiver showed me how to create a class structure that mapped a COBOL record layout. I'm now trying to extend this, with a "mainframe" CICS Web Service that returns 10 occurrences of a record.

With 1 occurrence a class structure like this works perfectly, with program JSPG2 returning one Employee record at a time: - -
C#:
            public class OJSPG2_
            {
                // Header fields, e.g.
                public int JZ_Employee_BrowseCount { get; set; }
                public int JZ_Employee_MaxOccurs { get; set; }
                public string JZ_Employee_ReturnCode { get; set; }
                public class JZ_Employee_
                {
                    // Employee fields, e.g.
                    public string EMPNO { get; set; }
                }
                public JZ_Employee_ JZ_Employee { get; } = new JZ_Employee_ ();
            }
            public OJSPG2_ OJSPG2 { get; } = new OJSPG2_ ();
Program JSPG2A is similar to JSPG2 except that it returns 10 records at a time. It tests perfectly with a general test utility (ReadyAPI). I'm now trying to develop the C# interface code to handle this. Obviously the class structure for OJSPG2A is similar to OJSPG2 above, except that there are 10 occurrences of JZ-Employee. From the first example here it seems I should define JZ-Employee as JZ_Employee_[] with = new JZ_Employee_ [10], i.e.
C#:
public JZ_Employee_[] JZ_Employee { get; } = new JZ_Employee_[10]();

But when I add [] and [10] => message CS00149: -
Severity Code Description
Error CS0149 Method name expected
There was a suggested fix, but when I tried applying this things got worse.

What do I do next?
 
There is no need for the parenthesis when you create the array.
 
There is no need for the parenthesis when you create the array.
Thank you!!!! This
C#:
public JZ_Employee_[] JZ_Employee { get; } = new JZ_Employee_[10];
seems correct. Now to work out the logic in JSPG2A to handling scrolling when 17 records are returned 10 at a time :)
 
Back
Top Bottom