How to pass an ampersand variable value into a rexx variable



IBM's Command List programming language & Restructured Extended Executor

How to pass an ampersand variable value into a rexx variable

Postby oldnick » Tue Aug 10, 2010 12:53 pm

I need to get the length of a string in an ampersand variable that changes dynamically like a SCAN would read it

To get the idea of what I'm trying to do (but doesn't work obviously):

ADDRESS ISREDIT "(myvar) = &mydynamicvar"
say length(myvar)
or

ADDRESS ISREDIT var = length("&mydynamicvar")
say var

note that using just the mydynamicvar rexx variable is not what I want because it's not interpreted by the "ISREDIT" yet, I need to pass the interpreted value of &mydynamicvar like a SCAN would read it into a new rexx variable.

Is this possible ?

Thanks
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to pass an ampersand variable value into a rexx variable

Postby NicC » Wed Aug 11, 2010 1:47 am

You have to exec your pgm in batch...

 EXEC 'XXX.YYYYYYY.EXEC(DJC)' 'a parm'
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to pass an ampersand variable value into a rexx variable

Postby oldnick » Wed Aug 11, 2010 1:12 pm

Interesting, thanks

In the meantime I did it with some coding, I post it for others:

STR = "the string with the & variable"; BEFORE = "&ENVSRC."; AFTER = ENVSRC
DO FOREVER
POS = POS(BEFORE, STR)
IF POS == 0 THEN LEAVE
LB = LENGTH(BEFORE); LA = LENGTH(AFTER)
OVE = OVERLAY(AFTER, STR, POS)
STR = DELSTR(OVE, POS+LA, LB-LA)
END
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to pass an ampersand variable value into a rexx variable

Postby Bala1 » Wed Aug 11, 2010 1:45 pm

Hi Nic,
Thanks a lot for sharing the way to pass the parameters.
:-)
_____________________
Cheers,
Bala
Bala1
 
Posts: 15
Joined: Tue Apr 06, 2010 7:07 pm
Location: London, United Kingdom
Has thanked: 0 time
Been thanked: 0 time

Re: How to pass an ampersand variable value into a rexx variable

Postby NicC » Wed Aug 11, 2010 4:33 pm

whoops - I see I posted my post to the wrong thread! Still, it helped someone!
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post