Been looking for an easy way to code a two dimensional array? Here's a way to do it with a pointer. It uses a based array and pointer to reference a multiple occurrence data structure of like fields.
The example given shows a 5 x 5 2D Array. Think of the array as the column and the occurrence as the row.
The only drawback about using this 2D array is the fact that the pointer needs to be re-initialized every time the occurrence is switched. Making the pointer equal to the % Addr of the data structure does this.
D Array S Like(Field1) Dim(5) D Based(Pointer) D Pointer S * Inz(%Addr(DataStr)) D DataStr DS Occurs(5) D Field1 D Field2 D Field3 D Field4
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.