UniVerse 9.4 SSELECT bug? 
Author Message
 UniVerse 9.4 SSELECT bug?
The universe help text clearly says you can use SSELECT to
sort a dynamic array but the following short program does
not work for me:

SUB TEST.SORT

DARRAY = ''
DARRAY<1> = 'A'
DARRAY<2> = 'K'
DARRAY<3> = 'C'
DARRAY<4> = 'B'

SSELECT DARRAY
LOOP
WHILE READNEXT ID
   PRINT ID:
REPEAT
RETURN
END

This is the program output

Quote:
>RUN BP TEST.SORT

AKCB

Does anyone what I could be doing wrong?

Thanks,

Marco



Tue, 19 Apr 2005 23:46:12 GMT
 UniVerse 9.4 SSELECT bug?

Hi Marco,
I tried in Universe 9.4.1.4 and got same result as you.

Ilir

Quote:

> The universe help text clearly says you can use SSELECT to
> sort a dynamic array but the following short program does
> not work for me:

> SUB TEST.SORT

> DARRAY = ''
> DARRAY<1> = 'A'
> DARRAY<2> = 'K'
> DARRAY<3> = 'C'
> DARRAY<4> = 'B'

> SSELECT DARRAY
> LOOP
> WHILE READNEXT ID
>    PRINT ID:
> REPEAT
> RETURN
> END

> This is the program output

>>RUN BP TEST.SORT

> AKCB

> Does anyone what I could be doing wrong?

> Thanks,

> Marco



Fri, 22 Apr 2005 08:11:49 GMT
 UniVerse 9.4 SSELECT bug?
I am making a list of, shall I say, odd programming practices for an
article, and wonder about this one, which I find all over in some code
I'm working on:

Quote:

>> DARRAY = ''
>> DARRAY<1> = 'A'

Does anyone know why you wouldn't just say DARRAY='A', being clearer,
less to type and more efficient to boot, a clear home run in my book?

Chandru Murthi



Fri, 22 Apr 2005 14:59:37 GMT
 UniVerse 9.4 SSELECT bug?
There is one good reason for the code you showed, Chandru. Some people
need for life to be difficult or more complex than necessary. That
sort of person would use first kind of code below. Others like for
life to be simple and easy. They would use the single statement you
mentioned.

Along the line of reasons, IME, here's how it goes: People decide what
they are going to do -- THEN, they figure out the reasons that support
whatever they did. Seldom do reasons preceed actions. :-)

Steve



Quote:
>I am making a list of, shall I say, odd programming practices for an
>article, and wonder about this one, which I find all over in some code
>I'm working on:

>>> DARRAY = ''
>>> DARRAY<1> = 'A'

>Does anyone know why you wouldn't just say DARRAY='A', being clearer,
>less to type and more efficient to boot, a clear home run in my book?

>Chandru Murthi



Sat, 23 Apr 2005 04:35:13 GMT
 UniVerse 9.4 SSELECT bug?
I can think of no good reason for doing it that way, but there are a couple
of bad reasons based on the probability that the programmer didn't really
know what he was doing.  Suspenders and belt would be one possible motive -
not necessary of course.  Trying to force an attribute mark might be
another - won't work of course.  One of the better known programmers in the
Miami area always used the construct:
    FOR X = 1 TO X + 1 UNTIL ARRAY<X> = ''
This works if there are no embedded nulls but it certainly seems to qualify
as a strange practice.
BobJ

Quote:
> I am making a list of, shall I say, odd programming practices for an
> article, and wonder about this one, which I find all over in some code
> I'm working on:

> >> DARRAY = ''
> >> DARRAY<1> = 'A'

> Does anyone know why you wouldn't just say DARRAY='A', being clearer,
> less to type and more efficient to boot, a clear home run in my book?

> Chandru Murthi



Sat, 23 Apr 2005 05:12:47 GMT
 UniVerse 9.4 SSELECT bug?
I am surprised by the comments on this.  Although the construct is not
necessary, it is certainly not confusing. The implication of the code in
question is that DARRAY is a dynamic array, not just a single variable.  I
might use this syntax if I were not filling any other 'attributes' at the
same time, just to emphasize that it was in fact a dynamic array being
initialized..

Then, of course,  the construct
DARRAY=''
DARRAY<2>='A'
must be that way.  Is that more clear being that it is required?


Quote:
> I am making a list of, shall I say, odd programming practices for an
> article, and wonder about this one, which I find all over in some code
> I'm working on:

> >> DARRAY = ''
> >> DARRAY<1> = 'A'

> Does anyone know why you wouldn't just say DARRAY='A', being clearer,
> less to type and more efficient to boot, a clear home run in my book?

> Chandru Murthi



Sat, 23 Apr 2005 06:54:36 GMT
 UniVerse 9.4 SSELECT bug?
I agree with George. I probably set the dynamic array to null just out of
habit more than anything else, but the expression DARRAY="" leaves no doubt
that this is the initial usage of that array.

--

Jeffrey Kaufman
Key Data Systems Group
www.keydat.com
559-432-3832
559-432-4657 fax


Quote:
> I am surprised by the comments on this.  Although the construct is not
> necessary, it is certainly not confusing. The implication of the code in
> question is that DARRAY is a dynamic array, not just a single variable.  I
> might use this syntax if I were not filling any other 'attributes' at the
> same time, just to emphasize that it was in fact a dynamic array being
> initialized..

> Then, of course,  the construct
> DARRAY=''
> DARRAY<2>='A'
> must be that way.  Is that more clear being that it is required?



> > I am making a list of, shall I say, odd programming practices for an
> > article, and wonder about this one, which I find all over in some code
> > I'm working on:

> > >> DARRAY = ''
> > >> DARRAY<1> = 'A'

> > Does anyone know why you wouldn't just say DARRAY='A', being clearer,
> > less to type and more efficient to boot, a clear home run in my book?

> > Chandru Murthi



Sat, 23 Apr 2005 07:03:27 GMT
 UniVerse 9.4 SSELECT bug?

Quote:

> I am making a list of, shall I say, odd programming practices for an
> article, and wonder about this one, which I find all over in some code
> I'm working on:

>>> DARRAY = ''
>>> DARRAY<1> = 'A'

> Does anyone know why you wouldn't just say DARRAY='A', being clearer,
> less to type and more efficient to boot, a clear home run in my book?

> Chandru Murthi

It just seems to me that a number of junior-types or
well-stuck-in-their-ways types aren't really aware that, when new, X is the
same as X<1> or X<1,1,1>. They might properly initialize a variable the same
way for multi values (X = '' ; X<1,1,1> = 'A'), and simply not do the heavy
thinking needed to realize they don't need to do it for attributes.

Ed



Sat, 23 Apr 2005 07:28:41 GMT
 UniVerse 9.4 SSELECT bug?

Quote:

> I am making a list of, shall I say, odd programming practices for an
> article, and wonder about this one, which I find all over in some code
> I'm working on:

>>> DARRAY = ''
>>> DARRAY<1> = 'A'

> Does anyone know why you wouldn't just say DARRAY='A', being clearer,
> less to type and more efficient to boot, a clear home run in my book?

> Chandru Murthi

This is appropriate or ignorant depending on two variables, shop
standards, and the where this code is in the program. I see value to
being able to open a program (with ED and typing "L/= ''" to find where
my arrays are being reset. That said, as Ed posted earlier, it could be
the children coding again?

my 2, Patrick <;=)

P.S. I'll usually follow standards, it's less work than maintaining a
disparate code base. Of course my preference is to *create* the
standards <g> (age has its advantages).



Sat, 23 Apr 2005 08:11:19 GMT
 UniVerse 9.4 SSELECT bug?
It's been a while since I've worked on Universe, but if I recall, you
can't SSELECT on the same variable. Try:

SSELECT DARRAY TO ID.LIST
LOOP
WHILE READNEXT ID FROM ID.LIST
   PRINT ID:
REPEAT
RETURN
END



Sat, 23 Apr 2005 09:57:49 GMT
 UniVerse 9.4 SSELECT bug?
On Mon, 04 Nov 2002 01:59:37 -0500,

Quote:

>I am making a list of, shall I say, odd programming practices for an
>article, and wonder about this one, which I find all over in some code
>I'm working on:

>>> DARRAY = ''
>>> DARRAY<1> = 'A'

>Does anyone know why you wouldn't just say DARRAY='A', being clearer,
>less to type and more efficient to boot, a clear home run in my book?

It's explicit initialization of the array to null, and subsequent
setting of it to "A", with the casual reader recognizing that it's a
dynamic array.

If DARRAY were passed into a subroutine, and further elements were
added, the reader/modifier wouldn't be surprised, as the "typing" of
the variable had already been done.

--
Allen Egerton



Sat, 23 Apr 2005 10:54:49 GMT
 UniVerse 9.4 SSELECT bug?
"Patrick Latimer" wrote
Quote:

> > I am making a list of, shall I say, odd programming practices for an
> > article, and wonder about this one, which I find all over in some code
> > I'm working on:

> >>> DARRAY = ''
> >>> DARRAY<1> = 'A'

> > Does anyone know why you wouldn't just say DARRAY='A', being clearer,
> > less to type and more efficient to boot, a clear home run in my book?

> > Chandru Murthi

> This is appropriate or ignorant depending on two variables, shop
> standards, and the where this code is in the program. I see value to
> being able to open a program (with ED and typing "L/= ''" to find where
> my arrays are being reset. That said, as Ed posted earlier, it could be
> the children coding again?

> my 2, Patrick <;=)

> P.S. I'll usually follow standards, it's less work than maintaining a
> disparate code base. Of course my preference is to *create* the
> standards <g> (age has its advantages).

Our shop is even more dogmatic;  we'd replace the 1 with an EQUated
parameter so we could do global searches on the whole project's source
code.
The given form does make sense if you cut 'n paste
boilerplate much, and feel  <1>  might usually need tweaking.


Sat, 23 Apr 2005 12:04:19 GMT
 
 [ 36 post ]  Go to page: [1] [2] [3]

 Relevant Pages 

1. Problem W/ UniVerse Obejcts and Windows 2000 Server (UniVerse 9.4 for NT)

2. Informix Universe 9.4

3. Getting started in Universe 9.4, Tcl

4. uniVerse 9.4

5. UniVerse 9.4 on AIX 4.3.2

6. Universe NT upgrade from 9.4 to 9.5.1.1

7. Universe 9.4 for Windows NT

8. Universe 9.4 Available on NT

9. Upgrading from 9.4.*** to 9.5.*** of Universe

10. UniVerse NT 9.4 Spooling query

11. ODBC - Access to uniVerse 9.4

12. Installing Informix 9.4 IDS on AIX Bombed out with this error


 
Powered by phpBB® Forum Software