It is recommended that the extra variable be create to prevent unnecessary machine cycles. It was considered a "good programming practice" when we were using Prime computers back in the mid 1980's. The explanation was that every iteration of the FOR / NEXT loop caused the cpu to calculate the ending value. The DCOUNT was executed on every iteration. Setting this value to a variable, did the calculation once. It may not seem like much, but when you have large arrays and a large number of records to process, this makes very good sense.

Rich Samamrtino

At 10:27 AM 9/29/2005 +0100, you wrote:
Why do you need to create an extra variable (LAST)? It only make sense if
the number of elements in ARRAY is really big. If you expect it to have 1 to
10 elements an extra variable only makes your code more difficult to
maintain.

On REMOVE I completely agree with you - it just makes it more difficult to
understand the code without giving anything in return.

----- Original Message -----
From: "Mark Johnson" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, September 27, 2005 10:46 PM
Subject: Re: [U2] Good Programming Practice Question.........


> Another good suggestion:
> Use:
> LAST=DCOUNT(ARRAY,CHAR(253))
> FOR I=1 TO LAST
> blah
> NEXT I
> instead of
> FOR I=1 TO DCOUNT(ARRAY,CHAR(253))
>
> I know that REMOVE is pretty promoted here but most times I use a FOR/NEXT
> loop because I don't want to maintain a separate mv variable for using any
> other associated attributes.
>
> My 1 cent.
>
> ----- Original Message -----
> From: "Keith W. Roberts" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Tuesday, September 27, 2005 5:14 PM
> Subject: RE: [U2] Good Programming Practice Question.........
>
>
> > I most heartily agree!  Numbers in the labels don't elucidate; they
merely
> > increase the length.  And I'm pretty sure I know that "U" comes
somewhere
> > after "S". :)
> >
> > My $0.02 (on issues ancillary to the code itself) ...
> >
> > - make your BP files Type19 (DIR), so you can edit them outside of U2
> using
> > whatever cotton-pickin' editor you like
> >
> > - use source code control; absolutely anything is better than nothing,
and
> > there are good free ones for all platforms
> >
> > - agree on an indentation scheme and stick to it as a group, else
> get/create
> > a beautifier which enforces the chosen standards before code checkin
> >
> > -Keith
> >
> > ----Original Message----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Bill_H
> > Sent: Tuesday, September 27, 2005 1:35 PM
> > To: [email protected]
> > Subject: RE: [U2] Good Programming Practice Question.........
> >
> > > Kevin:
> > >
> > > Not if you alphabetize the labels; then it works just like numeric.
> > > :-)
> > >
> > > Bill
> > >
> > >> -----Original Message-----
> > >> From: [EMAIL PROTECTED]
> > >> [mailto:[EMAIL PROTECTED] On Behalf Of Kevin King
> > >> Sent: Tuesday, September 27, 2005 1:04 PM
> > >> To: [email protected]
> > >> Subject: RE: [U2] Good Programming Practice Question.........
> > >>
> > >> And here's where the conflict begins.  When looking through a
> > >> big program, I much prefer numeric labels in order with comments vs.
> > >> alphanumeric labels.  With numeric labels in order you find
> > >> 1800 and if you're looking for 2000 you know to look farther
> > >> down, 1000, go up.
> > >> With alpha labels if you find SELECT.FILE and are looking for
> > >> UPDATE.FILES, you have nothing but experience to know whether
> > >> to look up or down from there.
> > >>
> > >> Numeric labels are good.  Not ordering or commenting them is
> > >> bad.  And not putting comments around all labels to make them
> > >> more easily distinguished from the rest of the program is
> > >> near unforgiveable.
> > >>
> > >> -K
> > >>
> > >> -----Original Message-----
> > >> From: [EMAIL PROTECTED]
> > >> [mailto:[EMAIL PROTECTED] On Behalf Of Allen E.
> > >> Elwood Sent: Tuesday, September 27, 2005 12:40 PM
> > >> To: [email protected]
> > >> Subject: RE: [U2] Good Programming Practice Question.........
> > >>
> > >> My addition to this would be to use alphanumeric labels, and
> > >> to *have* a main calling section.  A main calling section
> > >> that looks like:
> > >>
> > >> GOSUB OPEN.AND.INIT
> > >> GOSUB SELECT.FILE
> > >> GOSUB PRE-PROCESS.VALIDITY.CHECKS
> > >> GOSUB PRINT.INVOICES
> > >> GOSUB UPDATE.FILES
> > >>
> > >> Looks so much better and is so easier to figure out than
> > >>
> > >> GOSUB 100
> > >> a bunch of statements
> > >> a bunch of statements
> > >> a bunch of statements
> > >> GOSUB 1250
> > >> a bunch of statements
> > >> a bunch of statements
> > >> a bunch of statements
> > >> GOSUB 1375
> > >> a bunch of statements
> > >> a bunch of statements
> > >> a bunch of statements
> > >> GOSUB 4000
> > >> a bunch of statements
> > >> a bunch of statements
> > >> a bunch of statements
> > >> GOSUB 9755
> > >> a bunch of statements
> > >> a bunch of statements
> > >> a bunch of statements
> > >>
> > >> IMNSHO - *=aee=*
> > -------
> > u2-users mailing list
> > [email protected]
> > To unsubscribe please visit http://listserver.u2ug.org/
> -------
> u2-users mailing list
> [email protected]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Richard Sammartino
Systems Analyst
Information Technology
School District of Philadelphia
440 North Broad Street
Philadelphia,  PA  19130
Phone: (215) 400-5086
Fax: (215) 400-4411 -------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to