Re: Is there such a thing as dynamic arrays in classic rexx?



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.
.



Relevant Pages

  • Help in French|Spanish|German translation.
    ... I am also an author of User-defined string functions. ... WORDTRANEX (cSearched, cArExpressionSought | cExpressionSough, ... each string of the array is searched ... If the parameter nArStartOccurrence is -1 or omitted, the replacement starts ...
    (microsoft.public.fox.helpwanted)
  • Re: passing a string to a dll
    ... Joe, I really appreciate you taking the time to demonstrate this. ... sure how I would implement indexing it for random alphanumeric codes. ... I might handle the array. ... I actually have been wondering if I could use a second string ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... I might handle the array. ... I actually have been wondering if I could use a second string ... look at insertion cost, organization cost, and search cost. ...
    (microsoft.public.vc.mfc)
  • Re: Array Type Mismatch
    ... Dim resultAs String ... I am still somewhat confused as to why nothing is stored in the array. ... Public Function TextBoxGetLine(....arguments... ...
    (microsoft.public.access.formscoding)
  • Help in Spanish translation of the description of UDFs
    ... functions of minimum / maximum values among elements of an array column. ... GETALLWORDS- Inserts the words from a string into a global dimensioned ... WORDTRAN- Searches a character string for occurrences of a first word, ... ARRAYSUM- Returns the sum of all or a specified range of numeric (and/or ...
    (microsoft.public.fox.helpwanted)