Search code examples
mainframeadabas-natural

How to make a multidimensional array in Natural?


Does the redefine below in the code make #JF-ARRAY a single dimensional array in Natural. I want to make this a 5 dimensional array but I am not certain as if that would be something like.

   myVariable (A5/7500)

or if there is another format that would allow me to do this.

LOCAL                     
1 #JETFORMS-DATA (A7500)  
1 REDEFINE #JETFORMS-DATA 
  2 #JF-ARRAY (A1/7500)   

Question: How to make a array in Natural?


Solution

  • A bit (not much) of searching reveals this: http://documentation.softwareag.com/natural/nat638vms/pg/pg_defi_array.htm

    From the article:

    To define a one-dimensional array

    After the format and length, specify a slash followed by a so-called "index notation", that is, the number of occurrences of the array.

    For example, the following one-dimensional array has three occurrences, each occurrence being of format/length A10:

    DEFINE DATA LOCAL 
    1 #ARRAY (A10/1:3) 
    END-DEFINE 
    ...
    

    Specify an index notation for both dimensions:

    DEFINE DATA LOCAL 
    1 #ARRAY (A10/1:3,1:4) 
    END-DEFINE 
    ...
    

    A two-dimensional array can be visualized as a table. The array defined in the example above would be a table that consists of 3 "rows" and 4 "columns":