[comp.lang.rexx] arexx variable substitution

MJB@cup.portal.com (Martin J Brown-Jr) (06/01/90)

I'm having this problem with variable substitution in arexx commands.
In this first code segment the variable "i" gets properly drawn into
the "show()" command:

--------- code seg #1 ------------------------------------

/* tests for number of TxEd's currently running */

do i = 1 to 10 /* assume there won't be 10 editors running */

  z = show("P","TxEd"i) /* translates to show("P","TxEd1"), TxEd2, etc. */

  if z = 0 then break
end

-----------------------------------------------------------
/* assume there are 3 editors running, TxEd1, TxEd2, TxEd3 */
/* therefore, when "break" occurs i=4 */

/* ---------   continuing  ------------- */

address command e  /* this will start a new editor, which will be TxEd4 */

/* NOW COMES THE PROBLEM */

address 'TxEd'i 'LOA' a  /* loa = load, a = filename arg */

        ^^^^^^^^
I can't get this substitution to work 
Have any ideas how to make this work?
I think I've tried everything...well, hopefully not  ;->
Actually, I was surprised the substitution in the first code seg worked.
Even if you use a variable for the address, the address command won't work.

k = 'TxEd4'

address k 'LOA' a  /* doesn't work */

Any help would be appreciated!

                              - MJB -
                      USENET: mjb@cup.portal.com

new@udel.EDU (Darren New) (06/01/90)

In article <30411@cup.portal.com> MJB@cup.portal.com (Martin J Brown-Jr) writes:
>address 'TxEd'i 'LOA' a  /* loa = load, a = filename arg */

You need a variant of the command as documented under the "address" statement
in the manual.  It's something like
  address expr 'TxEd'i ...
or 
  address value 'TxEd'i ...
or something like that.  "It's in there"     
  (sorry, but I can't find my own manual at the moment)  -- Darren

sutela@utu.fi (Kari Sutela) (07/22/90)

In article <30411@cup.portal.com> MJB@cup.portal.com (Martin J Brown-Jr) writes:

>address 'TxEd'i 'LOA' a  /* loa = load, a = filename arg */
>
>        ^^^^^^^^
>I can't get this substitution to work 
>Have any ideas how to make this work?

Well, perhaps the manual isn't too clear on this point. If you use the
form "address something", the 'something' is taken as a literal string
and no variable substitution is performed. The answer is to use the form
"address value <expression>". For example:

address value 'TxEd'i
'LOA' a

should so the job.

Kari Sutela	sutela@polaris.utu.fi