Can I pass an X-Array to a map?

Is it possible to pass an X-Array to a map and display a portion of the array on the map? If I try to enter an * for the Upper Bounds in the array definition in the map, it doesn’t work.

I’d like to pass the whole X-Array, and in the map enter a variable as the “Start From” value, which I can then change in *PF-KEY rules to scroll thru the data in the map, without returning to the invoking program.

We’re running Natural 8.3.7 on AIX 6.1

Lars;

I have an article from Inside Natural that should work for you. If you will send me an e-mail at slrnaturalbiz@gmail.com I will send you the article as four pdf attachments to my return e-mail.

steve

Let’s say PGM-X is the programming object that contains the X-array definition.

1 #X-ARRAY (A2/1:*)

On map MAP-X you want to scroll 5 entries of the array at a time. To place the array on the map, you click Insert → Import → Data field. On the Import Data Field window, you select PGM-X, but #X-ARRAY is conspicuously absent from the Importable Data list.

This makes sense because at compile time no storage has been allocated to #X-ARRAY. It has no occurrences. How is Natural to paste the first five of zero entries on the map? There is no guarantee that an EXPAND ARRAY will be executed before the map is presented.

Rather than the X-array, paste an internal/work array of fixed size on the map.

1 #W-ARRAY (A2/5)

Place the scrolling logic in PGM-X, moving entries from #X-ARRAY into #W-ARRAY as needed.

Thanks, Ralph, that helps me understand why X-Arrays can’t be passed to a map.

The business rules in my case are such that it isn’t conceivable that there could be more than 1000 elements in the array, so I can code a max size of 1000 and leave the scrolling logic in the map PF-Key rules, where I prefer to have it, as explained in Steve’s four PDF attachments.

In cases where a max number of elements can’t be determined, it appears then that the scrolling logic must be moved to the program that calls the map.