On 24/06/11 21:50, Ed Clark wrote:
> yeah, you can add $OPTIONS STATIC.DIM to all the programs that you compile in 
> information flavor, or $OPTIONS -STATIC.DIM to the ones in pick flavor. I 
> would put the COMMON definition in an include file, along with whichever 
> static.dim directive that you choose. The choice would be based on WHY they 
> are using information flavor sometimes. I saw an application once where all 
> programs except 1 were in pick flavor, but they used information flavor for 
> just that 1 because they wanted arrays to have an element 0.

Something to watch out for in PI flavour ... Even if your array is
two-dimensional, there's only one element 0.

The other thing to watch out for (and a good case for using Prime-style
arrays) is if you only want to use the first few fields of a record.
When using MATREAD (and friends), if you don't provide enough elements,
Pick-style gives you an FM-delimited dynamic array in the *last* static
element of your array. Prime-style uses element 0 to store the excess
elements.

Which is why, if you overflow a dimensioned array, PI-style returns 0 as
the number of elements read, because it's the index of the last element
filled! A program I wrote blew up because somebody else didn't bother to
read my copious warnings that if you fed my routine dud data, it would
misbehave ... :-( they didn't specify max-elements properly :-(

So Pick-style, if you only have ten elements, you really need to declare
your array as 11, or you could have a nasty shock if a record does
acquire an 11th element ...

Cheers,
Wol
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to