Hi,
I wrote a procedure where i am passing a compound variable 'list1.'.
Heres the procedure:
Code:
call getList list1.
call getList list2.
getList:
arg list.
i=1
do while i < 5
list.i = i
i = i + 1
end
list.i = 'end'
return
But after the procedure executes, list1 & list2 dont show the expected output. I dont want to use PROCEDURE EXPOSE as it will make the 'list.' global to the rexx pgm. Moreover, i want the getList subroutine to be generic where i can pass an empty compound variable and get a filled in list after return. I even tried using Function instead of subroutine, it didnt work. Any solutions apart from duplicating the subroutine for 'list2.'?
not using ... the procedure construct will globalize the main environment to the subroutine/function anyway
also exposing will simply let You have full access to the exposed variables without the need of passing them as parms
giving You the (almost ) same environment as in the first case
the whole process should be reviewed, but with only what You have told it is not easy to give a good advice
one solution would be ...
1) not use the procedure construct
2) pass the name of the stem
3) use the INTERPRET instruction
something along the lines of
Code:
sub:
parse arg stemname
do i = 1 to count
interpret stemname"."i " = " i
end
interpret stemname".0 = " count
return
the standard for stems is to keep the number of stem entries in the .0 <thing>
so no need for a termination flag