Visual COBOL and .NET Arrays
The .NET System.Array class has many uses and is often encountered when you interact with other .NET classes and even user developed C# or VB.NET classes.
· Define and initialize .NET arrays in COBOL.NET
· Pass Arrays to other .NET methods that require a System.Array parameter
· Receive and process Arrays in your methods that are invoked from other Classes.
Note the use of the keyword Any. The definition of the Array has the following general format:
· Set the size of a Decimal Array
· Initialize the array with Decimal data (comp-3 gets mapped to Decimal to demonstrate use of existing COBOL data) using the Array length property in a perform loop
· Instantiate a C# class and pass it the Deciml array
· The C# class changes the the first occurance and returns
· Initializes the Array with data and implicitly initializes its size to 3
· Resize an array with the Array Resize method - increasing its size by 10
· Micro Focus COBOL.NET “set size of…” can also be used to resize an Array but will reinitialize the contents as well.
· Creates a Character Array from the ToCharArray method of the String Class
· Use the “perform varying…” syntax to iterate thru the Array an object
· Uses the AppendChar method of the SecureString class to build a .NET SecureString
· Stores the 3 Arrays above into one Array of Arrays with set content of…
· Implicitly sets the size to 3
· Essentially shows the flexibility of the types of things you can store in an Array
· One of several ways to create a “Jagged Array”
· Sets the sizes of a Jagged Array so that you have an Array of 2 Arrays.
· One Array has a size of 3 and the other has a size of 5
· Sets the value of the 3rd item in the 2nd Array to the current date/time