"You appear to be a novice programmer" ....ROFLMAO!
Mr Leckie's question was what was +-quicker.... Trim or for/next loop
but more important, apology accepted!

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Jonathan Leckie
Sent: Thursday, March 25, 2004 7:29 AM
To: [EMAIL PROTECTED]
Subject: Optimisation ?


I have the following piece of code :

IF REC<1>  '' THEN
  MAX=DCOUNT(REC<1>,VM)
  FOR LOP=1 TO MAX
    IF REC<1,LOP> = '' THEN
      REC=DELETE(REC,1,LOP,0)
      IF LOP = MAX THEN GO 300
      LOP=LOP-1
    END
  NEXT LOP
END

I wonder could this simply be replaced with :

IF REC<1>  '' THEN
  REC<1>=TRIM(REC<1>,@VM)
  GO 300
END

Can anyone see any problems with using TRIM to remove trailing, repeated and
initial value markers and therefore achieving the same effect without
looping through each multi-value?  This is on Unidata 3.3.2 incidentally.



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Anthony Youngman
Sent: Thursday, March 25, 2004 9:02 AM
To: U2 Users Discussion List
Subject: RE: Optimization ?


Particularly the "and works" bit.

May I suggest you go back to original code, and behave like an
old-fashioned programmer. Work through what the program is doing (ie do
what in the old days was called "executing by hand") and work out WHAT
is going wrong, and WHY.

Once you understand that, you'll see why the original code was stupid.
You'll also see why it is VERY HARD to get right. And you'll see why the
preferred version is preferred. As an old hand, I will assure you very
strongly that techniques that "make it hard to make a mistake" are a
very good weapon in a programmer's armoury.

You appear to be a novice programmer (if you're not, I apologise, but
it's your fault for making a fool of yourself). The mark of a
professional (ie a GOOD programmer, not just one who's paid for it) is
that he is eager to learn from his betters. There are plenty of damn
good programmers here. Learn from them!

Cheers,
Wol

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Harry Hambrick
Sent: 25 March 2004 13:38
To: U2 Users Discussion List
Subject: RE: Optimization ?

Preferred = Easy to read, well documented and works. 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Peter Olson
Sent: Thursday, March 25, 2004 8:30 AM
To: 'U2 Users Discussion List'
Subject: RE: Optimization ?

"This is the preferred version. It's also a bit slower." ???

 a min. of 6 slow lines of code vs. 1 quick line of code ?

define preferred. please.


Notice of Confidentiality:  The information included and/or attached in
this electronic mail transmission may contain confidential or privileged
information and is intended for the addressee.  Any unauthorized
disclosure, reproduction, distribution or the taking of action in
reliance on the contents of the information is prohibited.  If you
believe that you have received the message in error, please notify the
sender by reply transmission and delete the message without copying or
disclosing it. 

--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users
-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users




****************************************************************************
*******

This transmission is intended for the named recipient only. It may contain
private and confidential information. If this has come to you in error you
must not act on anything disclosed in it, nor must you copy it, modify it,
disseminate it in any way, or show it to anyone. Please e-mail the sender to
inform us of the transmission error or telephone ECA International
immediately and delete the e-mail from your information system.

Telephone numbers for ECA International offices are: Sydney +61 (0)2 9911
7799, Hong Kong + 852 2121 2388, London +44 (0)20 7351 5000 and New York +1
212 582 2333.

****************************************************************************
*******

-- 
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users


Notice of Confidentiality:  The information included and/or attached in this
electronic mail transmission may contain confidential or privileged
information and is intended for the addressee.  Any unauthorized disclosure,
reproduction, distribution or the taking of action in reliance on the
contents of the information is prohibited.  If you believe that you have
received the message in error, please notify the sender by reply
transmission and delete the message without copying or disclosing it. 

--
u2-users mailing list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users

Reply via email to