Re: Is there such a thing as dynamic arrays in classic rexx?
- From: Jeremy C B Nicoll <jeremy@xxxxxxxxxxxxxxxx>
- Date: Fri, 14 Sep 2007 16:41:48 +0100
Mr Coffee <coryssanchez@xxxxxxxxx> wrote:
Hello everyone...
Currently I have been making by without using any data structures in
my program but now I have a need for a dynamic array.
For instance:
I'm collecting values from a file such as:
String length of 0000006A000005F2 is 16
1.3.18.0.0.3330->internetRouter
String length of 0000006B0000084C is 16
1.3.18.0.0.6464->aggregateSystem
String length of 0000007B0000084D is 16
Object name: interfaceLink
String length of 0000006B0000084C is 16
1.3.18.0.0.6464->aggregateSystem
String length of 00000011000005E1 is 16
Object name: Non_SNA_Domain_Class
as you can see, there are 2 aggregatedSysm or 1.3.18.0.0.6464
I only want 1 to be saved for later processing.
For instance:
I want to store:
array.1 = "1.3.18.0.0.3330"
array.2 = "1.3.18.0.0.6464"
array.3 = "Non_SNA_Domain_Class"
but if the array element is already in there, I don't want to re-add
it...
so if I'm going to insert the following value: 1.3.18.0.0.6464 into
the array,
and you can see, 1.3.18.0.0.6464 is already in the array, at location:
array.2.
Then don't add it.
In the example you've given there's no obvious reason to use a stem variable
at all. You could just start off with:
things = ""
and later
if wordpos(element,things) = 0 then things = things element
which builds a list of unique elements. Instead of accessing the n'th
element of a stem, as array.n, you'd use word(things,n). Whether that is
sensible is another issue altogether.
Or you could keep a list of values as suggested above, but if you need
arrays of values elsewhere, just store the word-numbers elsewhere.
--
Jeremy C B Nicoll - my opinions are my own.
.
- References:
- Is there such a thing as dynamic arrays in classic rexx?
- From: Mr Coffee
- Is there such a thing as dynamic arrays in classic rexx?
- Prev by Date: Re: Is there such a thing as dynamic arrays in classic rexx?
- Next by Date: advice on how to read multiple files from a directory
- Previous by thread: Re: Is there such a thing as dynamic arrays in classic rexx?
- Next by thread: Re: Is there such a thing as dynamic arrays in classic rexx?
- Index(es):
Relevant Pages
|