Code Comments
Programming Forum and web based access to our favorite programming groups.I have 26 stemmed variables named WA , WB, WC, ... WZ. I want to perform certain operations (including sorting) on each variable, in turn. How may I do this? I've fumbled around with variations on CALL and INTERPRET, but not found the way. Please advise. Daniel B. Martin /* This is a contrived example. It is included here for illustrative purposes only. */ /* Sort the voter lists. */ Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' do j = 1 to length(Alphabet) string = 'call SortThem W' || substr(Alphabet,j,1) || '.' interpret string end j exit /* Sort Routine */ SortThem: procedure arg W. SORT W. A B return
Post Follow-up to this message"Daniel B. Martin" <daniel88b88martin@earthlink88.net> wrote: > I have 26 stemmed variables named WA , WB, WC, ... WZ. > I want to perform certain operations (including sorting) on > each variable, in turn. > > How may I do this? I don't know, but why have 26 separate stem variables, when you could place all the data in one variable? Eg if you made WC. into MyWStem.3. and WF. into MyWStem.6. and so on, then you could dispense with the interpret stuff. That's assuming that Reginald's SORT verb lets you do something like: SORT MyWStem.3. A B On theother hand it may just be that your SortThem: procedure arg W. SORT W. A B return needed to have an "expose" argument on the "procedure" statement. -- Jeremy C B Nicoll - my opinions are my own.
Post Follow-up to this messageJeremy Nicoll - news posts wrote: > I don't know, but why have 26 separate stem variables, when you could plac e > all the data in one variable? Your point is correct but there is good reason to have the 26 different stem variables. Daniel B. Martin
Post Follow-up to this message"Daniel B. Martin" <daniel88b88martin@earthlink88.net> wrote: > Jeremy Nicoll - news posts wrote: > > Your point is correct but there is good reason to have the > 26 different stem variables. I can't think of one... I doubt it'd make any difference to the way the program works or its efficiency. -- Jeremy C B Nicoll - my opinions are my own.
Post Follow-up to this message>Daniel B. Martin >I have 26 stemmed variables named WA , WB, WC, ... WZ. >I want to perform certain operations (including sorting) on >each variable, in turn. Utilize the USE ARG instruction in your subroutine, and pass the stem itself to the subroutine. Type "USE" (minus the quotes) into an RPC editor window, highlight it, and press F1. That brings up the help page for USE ARG. Something like: do_sort(MyStem.) RETURN do_sort: USE ARG var. SORT var. A RETURN
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.