I'm with Mecki on not seeing why the length of the program is relevant.
If I want to check for uniqueness of one of the counting variables, I'd
do this twice in the editor:

L FOR IV

If I get more than one hit, there's a problem.  If I'm looking for the
next available counter, I repeat from the top incrementing the variable
each time until I get no results.  You are correct in pointing out that
I'm only talking about for/next counting variables, though, and you
might also need to localize a more descriptive variable.  This is
typically how I'd handle that situation:

HOLD.LOCAL.VAR = LOCAL.VAR
GOSUB SOME.SUB
LOCAL.VAR = HOLD.LOCAL.VAR

Or if there are a lot of calls to the subroutine in various places and I
never want that variable to be modified by it I might do this:

GOSUB SOME.SUB

SOME.SUB:
HOLD.LOCAL.VAR = LOCAL.VAR
LOCAL.VAR = SOME.OTHER.VALUE
GOSUB SOME.OTHER.SUB
LOCAL.VAR = HOLD.LOCAL.VAR
RETURN

-John

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, January 26, 2012 12:17 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Passing by Value


Completely wrong :)
You apparently have the luxury of only working on programs written by
yourself.

In my world, we are called upon to make rapid changes in programs
written by twenty programmers over twenty years.
You haven't specified *how* you ensure that your counters are unique,
and by the way, the issue is not just counters, but any variable.



-----Original Message-----
From: Mecki Foerthmann <mec...@gmx.net>
To: u2-users <u2-users@listserver.u2ug.org>
Sent: Thu, Jan 26, 2012 12:13 pm
Subject: Re: [U2] Passing by Value


What has the length of the program to do with it?
 always abide to the rule that a for next counter in any internal
ubroutine has to be unique.
hat way even if the sub is called from within a for next loop the
ounters never conflict.
o it doesn't make any difference whatsoever if a program is 80 or 8000
ines long.
BTW a program with 8000 lines is usually a sign of poor design.
On 26/01/2012 19:02, Wjhonson wrote:
 You've never worked on programs that are 8000 lines long I take it :)




 -----Original Message-----
 From: John Hester<jhes...@momtex.com>
 To: U2 Users List<u2-users@listserver.u2ug.org>
 Sent: Thu, Jan 26, 2012 10:49 am
 Subject: Re: [U2] Passing by Value


 I like to use increasing roman numerals:
 FOR I = 1 TO COUNTER
   GOSUB PROCESS
 EXT I
 PROCESS:
 OR II = 1 TO COUNTER2
   FOR III = 1 TO COUNTER3
     FOR IV = 1 TO COUNTER4

     NEXT IV
   NEXT III
 EXT II
 ETURN
 -----Original Message-----
 rom: u2-users-boun...@listserver.u2ug.org
 mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
 ent: Thursday, January 26, 2012 10:09 AM
 o: u2-users@listserver.u2ug.org
 ubject: Re: [U2] Passing by Value

 n a related note, any clever ideas to localize a variable to a local
ubroutine?
 For I = 1 to 10
    GOSUB PROCESS
 ext I
 top
 3000 Lines of code later....
 PROCESS:
 OR I = 1 TO 20
 RINT I
 EXT I
 ETURN
 ______________________________________________
 2-Users mailing list
 2-us...@listserver.u2ug.org
 ttp://listserver.u2ug.org/mailman/listinfo/u2-users
 ______________________________________________
 2-Users mailing list
 2-us...@listserver.u2ug.org
 ttp://listserver.u2ug.org/mailman/listinfo/u2-users

 _______________________________________________
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/mailman/listinfo/u2-users
______________________________________________
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to