Somewhere along the road the Universe engineers dropped the need to DIMENSION 
the array again.
What I did was simply remove the offensive looking line, and after testing the 
subroutine, it's working normally.
In other words, it's using the passed array.

This came up because the subroutine, written 8 years ago, was actually setting 
a size *lower* than the element I needed to reference.  So I thought, oh no, 
it's gonna fail.  After testing, as you said below, it doesn't make any 
difference what size you give it.  So before I read your below, I simply 
removed it, tested my new functionality, referring to a high position element, 
and it works perfectly.

So.  Another, page in the "Weird Things You Find" booklet.


-----Original Message-----
From: Martin Phillips <[email protected]>
To: 'U2 Users List' <[email protected]>
Sent: Thu, Jul 26, 2012 2:44 am
Subject: Re: [U2] Passing dimensioned arrays


Hi,

> Well, in an INFORMATION flavor dimensioned arrays are supposed to be
> dynamically resizable 

The problem described by this thread is an oddity forced on us by the 
syntax/semantics of matrices passed as arguments.

If you define a subroutine as, for example,
   SUBROUTINE MYSUB(MAT X)
this tells the compiler that you are expecting to receive a whole matrix as an 
argument but does not have any way to say whether
this has one or two dimensions.

The designers of Prime Information chose to say that the subroutine must 
contain 
a DIM statement
   DIM X(2,4)
where the values in the brackets are simply counted to determine the 
dimensionality of the matrix and have no relevance to the
actual size. The Prime documentation says "A matrix passed as an argument must 
be dimensioned in an external subroutine before it
can be referenced. Any change to the [column and row] subscripts 
(redimensioning) is ignored and the dimensioning defined in the
calling program prevails".

Because the dimension values are ignored, they are often written as, for 
example,
   DIM X(1,1)
to emphasise that the values are meaningless.

Of course, it would be nice if the compiler treated the first DIM statement in 
this way but then redimensioned for any subsequent
DIM statement in the subroutine. Sadly, it doesn't.


Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
+44 (0)1604-709200



_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to