Thread View: bit.listserv.rexxlist
1 messages
1 total messages
Started by Jim McMaster (303)673-7419
Tue, 19 May 1992 15:21
Re: Command Line Parsing
Author: Jim McMaster (303)673-7419
Date: Tue, 19 May 1992 15:21
Date: Tue, 19 May 1992 15:21
77 lines
3005 bytes
3005 bytes
In message <199205191314.AA23043@csn.org> On Tue, 19 May 92 09:10:45 EDT you said: > > I'm writing a program that has several parameters passed to it as > > follows: > > > > Regress FN FT FM ( opt1 opt2 opt3 ... opt12 > > > > These values were easily retrieved with the following statement: > > > > Arg FN FT FM . ( OPT.1 OPT.2 OPT.3 ... OPT.12 > > > How about the following modification to your looping > I = 1 > While I <= 12 Do > > > > If (OPT.I = '') Then Leave > > > > Select > > When (OPT.I = 'INT') Then > > Do > > INTERCEPT = 'Y' > > ... more code ... > > End > > When (OPT.I = 'COL') Then > > Do > > COLLIN = 'Y' > > ... more code ... > > End > When (OPT.I = 'LAG') Then > Do > I = I+1 > LAGVAL = OPT.I > End > > ... Etc ... > > End > I = I+1 > > > > End /*I*/ > > > > This is pretty much how UNIX command lines are interpreted... > > B. Alton Brantley, Jr alton@cit.hmc.psu.edu > The Milton S. Hershey Medical Center Penn State College of Medicine > Hershey, PA USA 17033 I'm sorry, but I disagree with this approach. This is modifying the loop index inside a loop, and it is not a good programming practice in my opinion. You could just as easily write: Do I = 1 to 12 . . . I = I + 1 . . . End I This is legal, but clearly not a good thing to do. The code above does exactly the same function, but maintains a fiction that you are not. Besides, I do not think that will solve the original problem. There were originally a maximum of twelve options. Now some of them have parameters attached. The maximum is no longer twelve. The solution posted several times before is better: Do While Options <> '' Parse Var Options Opt Options . . . End Jim McMaster
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads