Sorry, I'm coming to this late and haven't read the previous emails. Are we talking about universe or unidata? universe has a $OPTIONS STATIC.DIM which you can use in any flavor. It is set by default in pick/in2/reality flavors. With $OPTIONS STATIC.DIM you get pick-style arrays:
1: array size is fixed at compile time. you can't DIM an array twice 2: arrays elements start from 1. There is no element 0 3: If MATREAD reads an item larger than the array, the extra attributes are appended to the last array element. So if the item has 3 attributes and the array has 2, array element 2 contains attributes 2 and 3. 4: Arrays in common are stored such that each array element is a common slot. This allows you to redefine common in different programs, eg: COMMON ADDRESS(5) COMMON ADDRESS1,ADDRESS2,CITY,STATE,ZIP A lot of applications take advantage of this trick to treat common like structured storage to access individual elements, but still being able to read or write an entire common block with one MATREAD. With $OPTIONS -STATIC.DIM you get prime-style arrays: 1: you can redimension arrays. 2: arrays have an element 0 3: MATREAD stores overflow elements in element 0. If the item has 3 attributes and the array has 2, attribute 3 goes into element 0 4: Arrays in common are stored as a single slot. the common redefinition trick will not work. unidata probably has a UDT.OPTIONS flag that works like STATIC.DIM. unidata in basictype 'P' acts mostly like universe with $OPTIONS STATIC.DIM, and unidata in basictype 'U' acts mostly like universe with -STATIC.DIM. The one big difference that I know of is that universe allows you to change the number of dimensions, eg DIM A(10) and then DIM A(2,5). unidata requires you to keep the same number of dimensions. When you give the INMAT function an array name as a parameter, it returns the current dimensions of the array, so INMAT() will tell you if an array has been redimensioned. When you call INMAT with no parameter, it returns various values based on what has happened. After an OPEN it returns the file's modulo. After a matread it returns the number of elements read, or 0 if the array overflowed. I don't know if this result is consistent between universe and unidata. On Aug 19, 2011, at 8:54 AM, Wols Lists wrote: > On 18/08/11 18:59, Rick Nuckolls wrote: >> You can redimension an array as long as it is not a common variable. This >> tends to be a “slow” process, or at least one that you do not want to do >> each time that you add something to the array. >> > I believe, in INFORMATION mode, you can redimension a common'd array. > You'll need to check :-) > > You certainly can't in Pick (or probably Pick mode) because of the way > its stored. PI only used one entry in the common block to store the > entire array, Pick used one entry for each element of the array. > >> You can use inmat( X ) to get a vector on the size of the array, as you >> might want to do within a subroutine. >> > There's also a way of telling how many elements have been read by a > MATREAD - I can't remember the function, possibly STATUS, but beware - > if there are too many elements it returns the last array element read. > In other words, in Pick mode it will return the size of the array. In > INFORMATION mode it returns 0! > >> Rick Nuckolls >> Lynden Inc > > Cheers, > Wol > _______________________________________________ > U2-Users mailing list > U2-Users@listserver.u2ug.org > http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users