I endorse that; I have seen very few situations where interpret was appropriate.

For any code constructing variable names, either explicitly or with compound 
variables, trace i is your friend.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Discussion List [[email protected]] on behalf of 
Jeremy Nicoll [[email protected]]
Sent: Saturday, May 30, 2020 7:08 AM
To: [email protected]
Subject: Re: REXX Interpret Question - weekend 'fun'

On Sat, 30 May 2020, at 11:54, Jeremy Nicoll wrote:
> On Sat, 30 May 2020, at 11:44, Lionel B Dyck wrote:
>
> > /* rexx */
> >
> > test = 'testx'
> >
> > interpret 'test'.1 '= var'
>
> That first builds the string  "test.1 = var" then executes it

For what I think you expected you'd have needed to code

   interpret test'.1 = var'

so first the string "textx.1 = var" is built, then that is executed.


It's FAR clearer, to use the value() function, eg

   namofvar = "testx.1"
   newvalue = var
   oldvalue  = value(namofvar,newvalue)

noting that value returns the existing value of the named variable
as well as (if there's a second parm) resetting it.


--
Jeremy Nicoll - my opinions are my own.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to