× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Web apps on the AS/400
  • From: "Leif Svalgaard" <leif@xxxxxxxx>
  • Date: Mon, 19 Mar 2001 10:03:37 -0600

how long does it take to execute that statement 100,000 times?
These string problems are not meant to be hard, because
most of the time the string manipulation we do is easy.
They are meant to compare languages, both how
EASY it is to write it, AND how fast it runs.
So, some timing please....

----- Original Message -----
From: Schenck, Don <Don.Schenck@pfizer.com>
To: <MIDRANGE-L@midrange.com>
Sent: Monday, March 19, 2001 8:53 AM
Subject: RE: Web apps on the AS/400


> One line of VB code:
>
>    TheAnswer = Replace(Text1.Text, Trim(Text1.Text),
> Replace(Trim(Text1.Text), " ", "_"))
>
>
>
> Sheesh ... THAT was EASY!
>
> -- Don Schenck
>
>    Schenck Technical Consulting
>    DonS@SchenckTech.com / www.SchenckTech.com
>
> > -----Original Message-----
> > From: Leif Svalgaard [mailto:leif@leif.org]
> > Sent: March 19, 2001 9:16 AM
> > To: MIDRANGE-L@midrange.com
> > Subject: Re: Web apps on the AS/400
> >
> >
> > maybe RPG isn't so bad after all  :-)
> > Here is another string problem:
> >
> > Given a string char(50), replace all
> > EMBEDDED spaces with hyphens,
> > but leave leading and trailing spaces alone.
> > E.g. "     this is a test      "
> > should become   "     this_is_a_test      "
> > :
> >
> > ----- Original Message -----
> > From: <Ken.Slaugh@cm-inc.com>
> > To: <MIDRANGE-L@midrange.com>
> > Sent: Sunday, March 18, 2001 11:58 PM
> > Subject: Re: Web apps on the AS/400
> >
> >
> > >
> > > Lief
> > >
> > > I ran this and debug showed that the execution took 1.266
> > seconds on our
> > > model 170. Actually I was rather surprised, I thought the
> > 1.3 seconds you
> > > reported was rather impressive and didn't think RPG would
> > fair so well.
> > >
> > > d TheString       s             50
> > > d TheShorter      s             50    inz('TEST STRING')
> > > d Nbr             s              6s 0
> > >
> > > d #Now            s               z
> > > d #Then           s               z
> > >
> > > c                   time                    #Then
> > >
> > > c                   do        100000        Nbr
> > > c                   evalr     TheString = %trim(TheShorter)
> > > c                   enddo
> > >
> > > c                   time                    #Now
> > > c     #Now          subdur    #Then         ##Sec:*MS        15 0
> > > c                   return
> > >
> > > ##SEC = 000000001266000
> > >
> > > Ken Slaugh  (707) 795-1512 x118
> > > Chouinard & Myhre, Inc.
> > > AS/400 Professional Administrator/MSE
> > > Client Access Specialist
> > > http://www.cm-inc.com/
> > >
> > >
> > >
> > >                     "Leif Svalgaard"
> > >                     <leif@leif.org>            To:
> > <MIDRANGE-L@midrange.com>
> > >                     Sent by:                   cc:
> > >                     owner-midrange-l@mi        Subject:
> > Re: Web apps on
> > the AS/400
> > >                     drange.com
> > >
> > >
> > >                     03/18/01 09:23 PM
> > >                     Please respond to
> > >                     MIDRANGE-L
> > >
> > >
> > >
> > >
> > >
> > > try it
> > > ----- Original Message -----
> > > From: <Ken.Slaugh@cm-inc.com>
> > > To: <MIDRANGE-L@midrange.com>
> > > Sent: Sunday, March 18, 2001 10:25 PM
> > > Subject: Re: Web apps on the AS/400
> > >
> > >
> > > >
> > > > Leif
> > > >
> > > >      Any idea how much slower this would be in RPG?
> > > >
> > > > d TheString       s             50
> > > > d TheShorter      s             50    inz('TEST STRING')
> > > > d Nbr             s              6s 0
> > > >
> > > > c                   do        100000        Nbr
> > > > c                   evalr     TheString = %trim(TheShorter)
> > > > c                   enddo
> > > >
> > > > c                   return
> > > >
> > > >
> > > > Ken Slaugh  (707) 795-1512 x118
> > > > Chouinard & Myhre, Inc.
> > > > AS/400 Professional Administrator/MSE
> > > > Client Access Specialist
> > > > http://www.cm-inc.com/
> > > >
> > > >
> > > >
> > > >                     "Leif Svalgaard"
> > > >                     <leif@leif.org>            To:
> > > <MIDRANGE-L@midrange.com>
> > > >                     Sent by:                   cc:
> > > >                     owner-midrange-l@mi        Subject:
> >   Re: Web apps
> > > on
> > > the AS/400
> > > >                     drange.com
> > > >
> > > >
> > > >                     03/18/01 06:20 PM
> > > >                     Please respond to
> > > >                     MIDRANGE-L
> > > >
> > > >
> > >
> > > >
> > > >
> > > >
> > > > From: Leif Svalgaard <leif@leif.org>
> > > > > From: Nathan M. Andelin <nathanma@haaga.com>
> > > > > > >Java is better for vector and string manipulation than RPG...
> > > > > > I don't disagree with the above statement.  It's just
> > that it's
> > > ealily
> > > > > > remedied
> > > > >
> > > > > These blanket statements are hard to accept at face value.
> > > > > The only way to verify this is to solve the same string problem
> > > > > in different languages and them to time the following things:
> > > > > 1) how long did it take to solve the problem
> > > > > 2) how fast does it run. (do it 100,000 times)
> > > > >
> > > > > So here is a sample problem:
> > > > >
> > > > > Given a string of length 50, move a shorter string to it,
> > > > > e.g. "test string", finally right-justify the string, so that it
> > > > > now holds:
> > > > > "                                       test string"
> > > > > The shorter string is not known at compile time.
> > > > >
> > > > > Once we have a solution to that in several languages
> > > > > we can make meaningful comparisons. If the language
> > > > > or a subroutine library already has a function that solves
> > > > > the problem, you are not allowed to use it.
> > > > > This later restriction is somewhat dubious: imagine
> > > > > you had a language that had a built-in solution to
> > > > > every problem your are likely to encounter, it is
> > > > > hard to disqualify using it.
> > > > >
> > > >
> > > > Here is one solution (in MI on a 150 box):
> > > > time to write: 4 min
> > > > time to run 100,000 times through the loop: 1.3 secs
> > > > code:
> > > > DCL DD THE-STRING  CHAR(50);
> > > > DCL DD THE-SHORTER CHAR(50);
> > > > DCL DD SIZE  BIN(2);
> > > > DCL DD START BIN(2);
> > > > DCL DD NBR   BIN(4);
> > > >     CPYBLAP     THE-SHORTER, "TEST STRING", " ";
> > > >     CPYNV       NBR, 100000;
> > > > AGAIN:
> > > >     TRIML       SIZE,  THE-SHORTER, " ";
> > > >     CMPNV(B)    SIZE,  0/HI(=+2);
> > > >     CPYNV       SIZE,  50;:
> > > >     SUBN        START, 51, SIZE;
> > > >     CPYBRAP     THE-STRING (START:SIZE), THE-SHORTER, " ";
> > > >     SUBN(SB)    NBR, 1/POS(AGAIN);
> > > >
> > > >     RTX      *;
> > > >
> > > >
> > > >
> > > > +---
> > > > | This is the Midrange System Mailing List!
> > > > | To submit a new message, send your mail to
> > MIDRANGE-L@midrange.com.
> > > > | To subscribe to this list send email to
> > MIDRANGE-L-SUB@midrange.com.
> > > > | To unsubscribe from this list send email to
> > > > MIDRANGE-L-UNSUB@midrange.com.
> > > > | Questions should be directed to the list owner/operator:
> > > > david@midrange.com
> > > > +---
> > > >
> > > >
> > > >
> > > >
> > > > +---
> > > > | This is the Midrange System Mailing List!
> > > > | To submit a new message, send your mail to
> > MIDRANGE-L@midrange.com.
> > > > | To subscribe to this list send email to
> > MIDRANGE-L-SUB@midrange.com.
> > > > | To unsubscribe from this list send email to
> > > MIDRANGE-L-UNSUB@midrange.com.
> > > > | Questions should be directed to the list owner/operator:
> > > david@midrange.com
> > > > +---
> > >
> > > +---
> > > | This is the Midrange System Mailing List!
> > > | To submit a new message, send your mail to
> > MIDRANGE-L@midrange.com.
> > > | To subscribe to this list send email to
> > MIDRANGE-L-SUB@midrange.com.
> > > | To unsubscribe from this list send email to
> > > MIDRANGE-L-UNSUB@midrange.com.
> > > | Questions should be directed to the list owner/operator:
> > > david@midrange.com
> > > +---
> > >
> > >
> > >
> > >
> > > +---
> > > | This is the Midrange System Mailing List!
> > > | To submit a new message, send your mail to
> > MIDRANGE-L@midrange.com.
> > > | To subscribe to this list send email to
> > MIDRANGE-L-SUB@midrange.com.
> > > | To unsubscribe from this list send email to
> > MIDRANGE-L-UNSUB@midrange.com.
> > > | Questions should be directed to the list owner/operator:
> > david@midrange.com
> > > +---
> >
> > +---
> > | This is the Midrange System Mailing List!
> > | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
> > | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
> > | To unsubscribe from this list send email to
> > MIDRANGE-L-UNSUB@midrange.com.
> > | Questions should be directed to the list owner/operator:
> > david@midrange.com
> > +---
> >
> +---
> | This is the Midrange System Mailing List!
> | To submit a new message, send your mail to MIDRANGE-L@midrange.com.
> | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
> | To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator:
david@midrange.com
> +---

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.