>If I understand your problem, you can use INSERT exactly as you would with dynamic arrays: > > INS newValue1 BEFORE FLD(1)<1,VMC> > INS newValue2 BEFORE FLD(2)<1,VMC> > INS newValue3 BEFORE FLD(3)<1,VMC> > etc.
Heck, it is *possible* to INS *attributes*, not just values or subvalues: INS newValue1 BEFORE ARR(1)<AMC> INS newValue2 BEFORE ARR(2)<AMC> INS newValue3 BEFORE ARR(3)<AMC> etc. (Guess what happens if you MATWRITE this.) --------------------- >"how about just adding the new elements to the end" > >cause the program will go ka-boom as soon as last.pos exceeds inmat( arr1 ) ? >we'll need to insure it doesn't blow past this threshold... You can dynamically "redimension" (see footnote) as needed (except for arrays defined in COMMON). For example: During pgm init: $OPTIONS -STATIC.DIM (needed for UV's Pick-Flavor) ARR.MAX = 1000 DIM ARR1( ARR.MAX ), ARR2( ARR.MAX ) Somewhere in body of program: LAST.POS+= 1 IF LAST.POS > ARR.MAX THEN ARR.MAX+= 1000 (or ARR.MAX = POS or ARR.MAX = POS+1000 or ...) DIM ARR1( ARR.MAX ), ARR2( ARR.MAX ) END ARR1(LAST.POS) = new.element1 ARR2(LAST.POS) = new.element2 I like the idea of adding to the end of the array but keeping a dynamic array containing an ordered list of array pointers. INS LAST.POS BEFORE POINTER.LIST<N> Then at some point you can reorder ARR1 & ARR2 themselves if you need to. That is, do it once (say before writing or otherwise using) instead of every time a new element is "inserted". But we don't really know enough about what you're trying to accomplish to say what's appropriate. ----------------------- Footnote: "Redimension" is the usually used word, but it's meaning is not what you learned in Linear Algebra. We get 1-, or 2-dimensional arrays, period. (Don't know why. I have often wanted a 3- or more-dimensional array.) The size of one of those dimensions is what is dynamically reconfigurable. Actually, you can redimension, using mathematical definition of "dimension": $OPTIONS -STATIC.DIM DIM ARR( 100 ) ;* 1-dimensional array DIM ARR( 2,50 ) ;* 2-dimensional array but it doesn't quite do to your data what you might expect. 3D arrays are illegal, won't compile: DIM ARR( 2, 5, 10 ) ----------------------- cds ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/