Comentarios (5)

1 238B_Ken_Sharpe ha hecho un comentario el Enlace permanente

Try using arg(1)... <div>&nbsp;</div> /* rexx */ <br /> stem="mystem" <br /> call setvars stem <br /> say "MYSTEM.A="mystem.a <br /> say "MYSTEM.B="mystem.b <br /> exit 0 <div>&nbsp;</div> setvars: <br /> interpret setvars2(arg(1)) <br /> return <div>&nbsp;</div> setvars2: procedure <br /> parse arg stem <br /> return stem".A=1;"stem".B=2;" <div>&nbsp;</div> I have been using the technique with REXX in Netview for some time. The idea of using a wrapper is nice. I also use an assembler program to do simular (recursive) parsing which assembler program is called from REXX and sets the REXX variables that live beyond the execution of the assembler program.

2 MartinPacker ha hecho un comentario el Enlace permanente

Thanks Ken! That worked nicely! And taking your idea here's how to set a ".DICT" variable to contain a kind of dictionary - by repurposing the command string that gets interpreted: <div>&nbsp;</div> <div>&nbsp;</div> Replace <div>&nbsp;</div> <div>&nbsp;</div> setvars2(arg(1)) <div>&nbsp;</div> <div>&nbsp;</div> with <div>&nbsp;</div> <div>&nbsp;</div> <div>&nbsp;</div> interpret arg(1)".dict='"setvars2(arg(1))"'" <div>&nbsp;</div> <div>&nbsp;</div> <div>&nbsp;</div> And you get mystem.dict set with <div>&nbsp;</div> <div>&nbsp;</div> "mystem.A=1;mystem.B=2;"

3 KentFiala ha hecho un comentario el Enlace permanente

This is what the VALUE function is for. Try this code: <div>&nbsp;</div> /* rexx */ <br /> stem="mystem" <br /> call setvars stem <br /> say "MYSTEM.A="mystem.a <br /> say "MYSTEM.B="mystem.b <br /> exit 0 <div>&nbsp;</div> setvars: <br /> call value arg(1)||".A",1 <br /> call value arg(1)||".B",2 <br /> return

4 MartinPacker ha hecho un comentario el Enlace permanente

Thanks Kent for the VALUE tip. :-) Would that work recursively, do you think? That's at least half of the motivation behind my original example.

5 KentFiala ha hecho un comentario el Enlace permanente

I'm afraid I don't have a deep enough grasp of what you're doing with recursion to answer that. I can see how the ability to package everything up in a single string might provide a cleaner solution.