Re: [U2] easy way to get count of a DIM()?

2011-08-19 Thread Wols Lists
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


Re: [U2] easy way to get count of a DIM()?

2011-08-19 Thread Ed Clark
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


Re: [U2] easy way to get count of a DIM()?

2011-08-19 Thread Allen E. Elwood
DIM X(ARRAY.SIZE)
X.COUNT = ARRAY.SIZE

Then just pass them both 

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Chris Austin
Sent: Thursday, August 18, 2011 10:57 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] easy way to get count of a DIM()?


We're trying to create the dimensioned array at run time with a size based
on a variable, which works in UniVerse when using the -STATIC.DIM option. We
need to know (in another program), what the size of that dimensioned array
is.

Chris


 From: ggal...@wyanokegroup.com
 To: u2-users@listserver.u2ug.org
 Date: Thu, 18 Aug 2011 12:48:53 -0500
 Subject: Re: [U2] easy way to get count of a DIM()?
 
 Dimensioned arrays do not change their sizes.
 
 If you DIM x(25), the size of x is 25
 
 It's not like a dynamic array
 
 However, when you MATWRITE the array to disk, it will only write out
 up to the last physical data in the array, and ignore the trailing
 blank slots.
 
 George
 
  -Original Message-
  From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- 
  boun...@listserver.u2ug.org] On Behalf Of Chris Austin
  Sent: Thursday, August 18, 2011 1:44 PM
  To: u2-users@listserver.u2ug.org
  Subject: Re: [U2] easy way to get count of a DIM()?
  
  
  Yes,
  
  That is correct DIM X(25) to initialize X, how do we then get the 
  size of X?
  
  Thanks,
  
  Chris
  
  
   From: gglorfi...@vertisinc.com
   To: u2-users@listserver.u2ug.org
   Date: Thu, 18 Aug 2011 13:41:17 -0400
   Subject: Re: [U2] easy way to get count of a DIM()?
  
   First off, I've never seen that syntax before.  Do you mean:
  
   DIM X(25)
  
   or do you mean you are setting X to the 25th value in a 
   dimensioned
  variable?  And I don't understand what you mean when you say some 
  records get taken out.  How are they taken out?
  
   I'm a little confused by your question.
  
   -Original Message-
   From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-
  boun...@listserver.u2ug.org] On Behalf Of Chris Austin
   Sent: Thursday, August 18, 2011 1:30 PM
   To: u2-users@listserver.u2ug.org
   Subject: [U2] easy way to get count of a DIM()?
  
  
   I'm trying to get the count of a dimensioned array DIM() in 
   UniVerse
  10.x
  
   Let's say we have a variable that's set to an array:
  
   X = DIM(25)
  
   if I wanted to find out the count of X later on in the program 
   (let's
  say some records get taken out and we need the count), how would
   you do this?
  
   Thanks,
  
   Chris
  
  
   ___
   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

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


Re: [U2] easy way to get count of a DIM()?

2011-08-18 Thread Glorfield, Gordon
First off, I've never seen that syntax before.  Do you mean:

DIM X(25)

or do you mean you are setting X to the 25th value in a dimensioned variable?  
And I don't understand what you mean when you say some records get taken out. 
 How are they taken out?

I'm a little confused by your question.

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Chris Austin
Sent: Thursday, August 18, 2011 1:30 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] easy way to get count of a DIM()?


I'm trying to get the count of a dimensioned array DIM() in UniVerse 10.x

Let's say we have a variable that's set to an array:

X = DIM(25)

if I wanted to find out the count of X later on in the program (let's say some 
records get taken out and we need the count), how would
you do this?

Thanks,

Chris

  
___
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] easy way to get count of a DIM()?

2011-08-18 Thread Chris Austin

Yes,

That is correct DIM X(25) to initialize X, how do we then get the size of X?

Thanks,

Chris


 From: gglorfi...@vertisinc.com
 To: u2-users@listserver.u2ug.org
 Date: Thu, 18 Aug 2011 13:41:17 -0400
 Subject: Re: [U2] easy way to get count of a DIM()?
 
 First off, I've never seen that syntax before.  Do you mean:
 
 DIM X(25)
 
 or do you mean you are setting X to the 25th value in a dimensioned variable? 
  And I don't understand what you mean when you say some records get taken 
 out.  How are they taken out?
 
 I'm a little confused by your question.
 
 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org 
 [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Chris Austin
 Sent: Thursday, August 18, 2011 1:30 PM
 To: u2-users@listserver.u2ug.org
 Subject: [U2] easy way to get count of a DIM()?
 
 
 I'm trying to get the count of a dimensioned array DIM() in UniVerse 10.x
 
 Let's say we have a variable that's set to an array:
 
 X = DIM(25)
 
 if I wanted to find out the count of X later on in the program (let's say 
 some records get taken out and we need the count), how would
 you do this?
 
 Thanks,
 
 Chris
 
 
 ___
 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] easy way to get count of a DIM()?

2011-08-18 Thread George Gallen
Dimensioned arrays do not change their sizes.

If you DIM x(25), the size of x is 25

It's not like a dynamic array

However, when you MATWRITE the array to disk, it will only write out
up to the last physical data in the array, and ignore the trailing
blank slots.

George

 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-
 boun...@listserver.u2ug.org] On Behalf Of Chris Austin
 Sent: Thursday, August 18, 2011 1:44 PM
 To: u2-users@listserver.u2ug.org
 Subject: Re: [U2] easy way to get count of a DIM()?
 
 
 Yes,
 
 That is correct DIM X(25) to initialize X, how do we then get the size
 of X?
 
 Thanks,
 
 Chris
 
 
  From: gglorfi...@vertisinc.com
  To: u2-users@listserver.u2ug.org
  Date: Thu, 18 Aug 2011 13:41:17 -0400
  Subject: Re: [U2] easy way to get count of a DIM()?
 
  First off, I've never seen that syntax before.  Do you mean:
 
  DIM X(25)
 
  or do you mean you are setting X to the 25th value in a dimensioned
 variable?  And I don't understand what you mean when you say some
 records get taken out.  How are they taken out?
 
  I'm a little confused by your question.
 
  -Original Message-
  From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-
 boun...@listserver.u2ug.org] On Behalf Of Chris Austin
  Sent: Thursday, August 18, 2011 1:30 PM
  To: u2-users@listserver.u2ug.org
  Subject: [U2] easy way to get count of a DIM()?
 
 
  I'm trying to get the count of a dimensioned array DIM() in UniVerse
 10.x
 
  Let's say we have a variable that's set to an array:
 
  X = DIM(25)
 
  if I wanted to find out the count of X later on in the program (let's
 say some records get taken out and we need the count), how would
  you do this?
 
  Thanks,
 
  Chris
 
 
  ___
  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] easy way to get count of a DIM()?

2011-08-18 Thread Chris Austin

We're trying to create the dimensioned array at run time with a size based on a 
variable, which works in UniVerse
when using the -STATIC.DIM option. We need to know (in another program), what 
the size of that dimensioned array is.

Chris


 From: ggal...@wyanokegroup.com
 To: u2-users@listserver.u2ug.org
 Date: Thu, 18 Aug 2011 12:48:53 -0500
 Subject: Re: [U2] easy way to get count of a DIM()?
 
 Dimensioned arrays do not change their sizes.
 
 If you DIM x(25), the size of x is 25
 
 It's not like a dynamic array
 
 However, when you MATWRITE the array to disk, it will only write out
 up to the last physical data in the array, and ignore the trailing
 blank slots.
 
 George
 
  -Original Message-
  From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-
  boun...@listserver.u2ug.org] On Behalf Of Chris Austin
  Sent: Thursday, August 18, 2011 1:44 PM
  To: u2-users@listserver.u2ug.org
  Subject: Re: [U2] easy way to get count of a DIM()?
  
  
  Yes,
  
  That is correct DIM X(25) to initialize X, how do we then get the size
  of X?
  
  Thanks,
  
  Chris
  
  
   From: gglorfi...@vertisinc.com
   To: u2-users@listserver.u2ug.org
   Date: Thu, 18 Aug 2011 13:41:17 -0400
   Subject: Re: [U2] easy way to get count of a DIM()?
  
   First off, I've never seen that syntax before.  Do you mean:
  
   DIM X(25)
  
   or do you mean you are setting X to the 25th value in a dimensioned
  variable?  And I don't understand what you mean when you say some
  records get taken out.  How are they taken out?
  
   I'm a little confused by your question.
  
   -Original Message-
   From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-
  boun...@listserver.u2ug.org] On Behalf Of Chris Austin
   Sent: Thursday, August 18, 2011 1:30 PM
   To: u2-users@listserver.u2ug.org
   Subject: [U2] easy way to get count of a DIM()?
  
  
   I'm trying to get the count of a dimensioned array DIM() in UniVerse
  10.x
  
   Let's say we have a variable that's set to an array:
  
   X = DIM(25)
  
   if I wanted to find out the count of X later on in the program (let's
  say some records get taken out and we need the count), how would
   you do this?
  
   Thanks,
  
   Chris
  
  
   ___
   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] easy way to get count of a DIM()?

2011-08-18 Thread Chris Austin

I figured it out from Brian's notes

SUBROUTINE TEST_HARNESS4
$INCLUDE LF_FINS LF_MASTER_INCLUDE
VERS='4.000'

DIM ARRAY(23)
CALL CALLED(MAT ARRAY)

RETURN

---

SUBROUTINE CALLED(MAT ARRAY)
VERS='4.000'
PRINT INMAT(ARRAY)
RETURN

---

returns:

23²1


 From: cjausti...@hotmail.com
 To: u2-users@listserver.u2ug.org
 Date: Thu, 18 Aug 2011 12:57:06 -0500
 Subject: Re: [U2] easy way to get count of a DIM()?
 
 
 We're trying to create the dimensioned array at run time with a size based on 
 a variable, which works in UniVerse
 when using the -STATIC.DIM option. We need to know (in another program), what 
 the size of that dimensioned array is.
 
 Chris
 
 
  From: ggal...@wyanokegroup.com
  To: u2-users@listserver.u2ug.org
  Date: Thu, 18 Aug 2011 12:48:53 -0500
  Subject: Re: [U2] easy way to get count of a DIM()?
  
  Dimensioned arrays do not change their sizes.
  
  If you DIM x(25), the size of x is 25
  
  It's not like a dynamic array
  
  However, when you MATWRITE the array to disk, it will only write out
  up to the last physical data in the array, and ignore the trailing
  blank slots.
  
  George
  
   -Original Message-
   From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-
   boun...@listserver.u2ug.org] On Behalf Of Chris Austin
   Sent: Thursday, August 18, 2011 1:44 PM
   To: u2-users@listserver.u2ug.org
   Subject: Re: [U2] easy way to get count of a DIM()?
   
   
   Yes,
   
   That is correct DIM X(25) to initialize X, how do we then get the size
   of X?
   
   Thanks,
   
   Chris
   
   
From: gglorfi...@vertisinc.com
To: u2-users@listserver.u2ug.org
Date: Thu, 18 Aug 2011 13:41:17 -0400
Subject: Re: [U2] easy way to get count of a DIM()?
   
First off, I've never seen that syntax before.  Do you mean:
   
DIM X(25)
   
or do you mean you are setting X to the 25th value in a dimensioned
   variable?  And I don't understand what you mean when you say some
   records get taken out.  How are they taken out?
   
I'm a little confused by your question.
   
-Original Message-
From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-
   boun...@listserver.u2ug.org] On Behalf Of Chris Austin
Sent: Thursday, August 18, 2011 1:30 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] easy way to get count of a DIM()?
   
   
I'm trying to get the count of a dimensioned array DIM() in UniVerse
   10.x
   
Let's say we have a variable that's set to an array:
   
X = DIM(25)
   
if I wanted to find out the count of X later on in the program (let's
   say some records get taken out and we need the count), how would
you do this?
   
Thanks,
   
Chris
   
   
___
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
  
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] easy way to get count of a DIM()?

2011-08-18 Thread Rick Nuckolls
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.

You can use  inmat( X ) to get a vector on the size of the array, as you might 
want to do within a subroutine.

Rick Nuckolls
Lynden Inc


On Aug 18, 2011, at 10:43 AM, Chris Austin wrote:

 
 Yes,
 
 That is correct DIM X(25) to initialize X, how do we then get the size of X?
 
 Thanks,
 
 Chris
 
 
 From: gglorfi...@vertisinc.com
 To: u2-users@listserver.u2ug.org
 Date: Thu, 18 Aug 2011 13:41:17 -0400
 Subject: Re: [U2] easy way to get count of a DIM()?
 
 First off, I've never seen that syntax before.  Do you mean:
 
 DIM X(25)
 
 or do you mean you are setting X to the 25th value in a dimensioned 
 variable?  And I don't understand what you mean when you say some records 
 get taken out.  How are they taken out?
 
 I'm a little confused by your question.
 
 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org 
 [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Chris Austin
 Sent: Thursday, August 18, 2011 1:30 PM
 To: u2-users@listserver.u2ug.org
 Subject: [U2] easy way to get count of a DIM()?
 
 
 I'm trying to get the count of a dimensioned array DIM() in UniVerse 10.x
 
 Let's say we have a variable that's set to an array:
 
 X = DIM(25)
 
 if I wanted to find out the count of X later on in the program (let's say 
 some records get taken out and we need the count), how would
 you do this?
 
 Thanks,
 
 Chris
 

 ___
 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