Re: [U2] Passing dimensioned arrays

2012-07-27 Thread Martin Phillips
Hi,

 The line is simply ignored as if it were not even there.
 If you make it bigger, then try to list past the end, the runtime blows up.
 If you make it smaller, you can still address the end cells normally.
 It's really as if the line isn't present.  Don't ask me why it works that 
 way, but hey.

As I said in my previous posting, this is how the designers of Prime 
Information documented that it would work. Depending on the
flavour of UniVerse you select, you either get Information style matrices with 
this behaviour or Pick style matrices that have
different rules.

Incidentally, because it is clear that some developers might actually want to 
be able to redimension matrices that were passed as
arguments, we spent about five minutes adding a REDIM statement to QM yesterday 
that treats argument variables just like any others.
I find it hard to believe that it would be difficult for UV to do the same if 
the demand is there.


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



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Passing dimensioned arrays

2012-07-27 Thread Wjhonson

But you also said that you *must* define the array in the subroutine.
And that part of it is apparently no longer true, because I removed that 
re-definition and it works fine.


-Original Message-
From: Martin Phillips martinphill...@ladybridge.com
To: 'U2 Users List' u2-users@listserver.u2ug.org
Sent: Fri, Jul 27, 2012 1:28 am
Subject: Re: [U2] Passing dimensioned arrays


Hi,

 The line is simply ignored as if it were not even there.
 If you make it bigger, then try to list past the end, the runtime blows up.
 If you make it smaller, you can still address the end cells normally.
 It's really as if the line isn't present.  Don't ask me why it works that 
 way, 
but hey.

As I said in my previous posting, this is how the designers of Prime 
Information 
documented that it would work. Depending on the
flavour of UniVerse you select, you either get Information style matrices with 
this behaviour or Pick style matrices that have
different rules.

Incidentally, because it is clear that some developers might actually want to 
be 
able to redimension matrices that were passed as
arguments, we spent about five minutes adding a REDIM statement to QM yesterday 
that treats argument variables just like any others.
I find it hard to believe that it would be difficult for UV to do the same if 
the demand is there.


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



___
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


Re: [U2] Passing dimensioned arrays

2012-07-26 Thread Wjhonson

I was thinking along those same lines Brian
But what it actually does is completely ignore the line as if it were not 
present.
If you do a VLIST in fact, it generates *no* object code for that line 
whatsoever.
I thought that was odd, but hey I can deal with it.



-Original Message-
From: Brian Leach br...@brianleach.co.uk
To: 'U2 Users List' u2-users@listserver.u2ug.org
Sent: Thu, Jul 26, 2012 2:03 am
Subject: Re: [U2] Passing dimensioned arrays


Well, in an INFORMATION flavor dimensioned arrays are supposed to be
dynamically resizable, which can sometimes be useful if you are using them
for temporary storage (building lists against category groups or the like). 
So the right action would be that it should allow redimensioning without
complaints as the array should just be a pointer to a dynamically allocated
structure, as in other languages.

If you use PICK flavor or $OPTIONS M then they should be fixed from
creation, reflecting the original limitations/addressing on the old Pick OS.
The rationale behind that was the speed at which individual elements could
be accessed and limitations on EQUating to field elements, which is why you
still see a lot of matread and matwrite even in cases where the benefits are
negligible in UniVerse.

It does make it a pain that you can't mix and match flavors if you have
named common, as the addressing/sizing of an INFORMATION and a PICK style
common block (which seem to follow the same pattern) are different.

Brian

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: 25 July 2012 23:28
To: u2-users@listserver.u2ug.org
Subject: [U2] Passing dimensioned arrays


I'm on Universe 10.2.3 in Information flavor and was surprised by something.
Admittedly I don't think I've actually come across this before, but it seems
like whoever wrote this, didn't understand how the system used it either.

If you dimensioned an array and then call a subroutine passing that array
CALL MYSUB(MAT SOMEARRAY)

And then in the MYSUB routine, you Dimension that same variable name again,
but to a different size, what do you expect the Runtime Engine would do?

A) It would redim the array to the new size
B) It would complain and throw a fit
C) It would ignore my new dimension command as if it weren't there at all



___
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

 
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Passing dimensioned arrays

2012-07-26 Thread Wjhonson

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 martinphill...@ladybridge.com
To: 'U2 Users List' u2-users@listserver.u2ug.org
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
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


Re: [U2] Passing dimensioned arrays

2012-07-26 Thread Bill Haskett
Of course, today's engineering failings are comparable to those from 30 
years ago.  :-)


Bill


- Original Message -
*From:* br...@brianleach.co.uk
*To:* 'U2 Users List' u2-users@listserver.u2ug.org
*Date:* 7/26/2012 10:15 AM
*Subject:* Re: [U2] Passing dimensioned arrays

Martin's answer is probably right (he usually is!)

Difference between what it does and what it *should* do.

I love all this legacy cr*p - engineering failings from 30 years ago getting
passed down through generations ..

Brian

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: 26 July 2012 17:23
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Passing dimensioned arrays


I was thinking along those same lines Brian But what it actually does is
completely ignore the line as if it were not present.
If you do a VLIST in fact, it generates *no* object code for that line
whatsoever.
I thought that was odd, but hey I can deal with it.



-Original Message-
From: Brian Leach br...@brianleach.co.uk
To: 'U2 Users List' u2-users@listserver.u2ug.org
Sent: Thu, Jul 26, 2012 2:03 am
Subject: Re: [U2] Passing dimensioned arrays


Well, in an INFORMATION flavor dimensioned arrays are supposed to be
dynamically resizable, which can sometimes be useful if you are using them
for temporary storage (building lists against category groups or the like).
So the right action would be that it should allow redimensioning without
complaints as the array should just be a pointer to a dynamically allocated
structure, as in other languages.

If you use PICK flavor or $OPTIONS M then they should be fixed from
creation, reflecting the original limitations/addressing on the old Pick OS.
The rationale behind that was the speed at which individual elements could
be accessed and limitations on EQUating to field elements, which is why you
still see a lot of matread and matwrite even in cases where the benefits are
negligible in UniVerse.

It does make it a pain that you can't mix and match flavors if you have
named common, as the addressing/sizing of an INFORMATION and a PICK style
common block (which seem to follow the same pattern) are different.

Brian

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: 25 July 2012 23:28
To: u2-users@listserver.u2ug.org
Subject: [U2] Passing dimensioned arrays


I'm on Universe 10.2.3 in Information flavor and was surprised by something.
Admittedly I don't think I've actually come across this before, but it seems
like whoever wrote this, didn't understand how the system used it either.

If you dimensioned an array and then call a subroutine passing that array
CALL MYSUB(MAT SOMEARRAY)

And then in the MYSUB routine, you Dimension that same variable name again,
but to a different size, what do you expect the Runtime Engine would do?

A) It would redim the array to the new size
B) It would complain and throw a fit
C) It would ignore my new dimension command as if it weren't there at all



___
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

  
___

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


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Passing dimensioned arrays

2012-07-26 Thread dennis bartlett
If the new size was bigger, it would populate those cells that were sent,
ie a (10) array sent would fill cells 1 - 10 of the (12) array

Theoretically f the new size was smaller, it would fill the array then put
the remaining ones into either the last or the zero cell depending on which
flavour, but it would probably just lose the remaining cells.
On Jul 26, 2012 8:55 AM, Wjhonson wjhon...@aol.com wrote:




___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Passing dimensioned arrays

2012-07-26 Thread Wjhonson

Nope that doesn't happen :)
The line is simply ignored as if it were not even there.
If you make it bigger, then try to list past the end, the runtime blows up.
If you make it smaller, you can still address the end cells normally.
It's really as if the line isn't present.  Don't ask me why it works that way, 
but hey.


-Original Message-
From: dennis bartlett dqbartl...@gmail.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Thu, Jul 26, 2012 5:40 pm
Subject: Re: [U2] Passing dimensioned arrays


If the new size was bigger, it would populate those cells that were sent,
ie a (10) array sent would fill cells 1 - 10 of the (12) array

Theoretically f the new size was smaller, it would fill the array then put
the remaining ones into either the last or the zero cell depending on which
flavour, but it would probably just lose the remaining cells.
On Jul 26, 2012 8:55 AM, Wjhonson wjhon...@aol.com wrote:




___
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


[U2] Passing dimensioned arrays

2012-07-25 Thread Wjhonson

I'm on Universe 10.2.3 in Information flavor and was surprised by something.
Admittedly I don't think I've actually come across this before, but it seems 
like whoever wrote this, didn't understand how the system used it either.

If you dimensioned an array and then call a subroutine passing that array
CALL MYSUB(MAT SOMEARRAY)

And then in the MYSUB routine, you Dimension that same variable name again, but 
to a different size, what do you expect the Runtime Engine would do?

A) It would redim the array to the new size
B) It would complain and throw a fit
C) It would ignore my new dimension command as if it weren't there at all



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users