home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!CESTRIAN.CCF.SWRI.EDU!CHRIS
- Return-Path: <chris@cestrian.ccf.swri.edu>
- Message-ID: <9208131418.AA0245@cestrian.ccf.swri.edu>
- Newsgroups: comp.lang.rexx
- Date: Thu, 13 Aug 1992 08:09:12 EST
- Sender: REXX Programming discussion list <REXXLIST@UGA.BITNET>
- From: chris@CESTRIAN.CCF.SWRI.EDU
- Subject: Re: Stem vars as arguments?
- Comments: To: REXXLIST@OHSTVMA.ACS.OHIO-STATE.EDU
- Lines: 63
-
- Dave,
- You would have won the bet. I had tested small pieces on the mainframe
- (VM/XA) and then just edited the sample in the note I was replying to.
-
- There were two major bluders in my example:
- 1. The PROCEDURE instruction, by default, hides all variables thus
- making access to the stem impossible.
-
- 2. The VM function FIND has been renamed to WORDPOS in OS/2. The
- help for both OS's is almost word for word.
-
- Here is a working example.
-
-
- /* */
- Opts.Label = 'Select an option A-C, X'
- Opts.0 = 4 /* No. options */
- Opts.1 = 'A'
- Opts.2 = 'B'
- Opts.3 = 'C'
- Opts.4 = 'X'
-
- Choice = GetChoice(Opts)
- say choice
- choice=getopts('Select options A-C or X $ A B C X')
- say choice
- exit
- /* ... */
-
- GetChoice:
- ARG Stem
- interpret 'lab='stem'.label' /* Get value of stem.label */
- SAY lab /* Use it for prompt */
- PULL Resp
- interpret 'range='stem'.0' /* Get value of stem.0 */
- do i = 1 TO range
- interpret 'choice='stem'.'i /* Get stem value */
- IF Resp = choice THEN /* This it ? */
- LEAVE
- END
- if resp<>choice then i = 1 /* Didn't match chose first */
- interpret 'ret='stem'.'i /* Get the choice */
- RETURN ret
-
- /*
- Note that the above method will only work with internal procedures.
- For the example as stated I would use something like this
- */
-
- getopts:
- parse arg label '$' choices
- say label
- pull choice
- if 0=wordpos(choice,choices) then choice=word(choices,1)
- return choice
-
- /* End of example */
-
- Sorry for the confusion. Guess I'll go wash the egg off my face now.
-
- Wizardy is Wonderful
-
- Later .....
-