Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Passing and returning a compound variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
vasif

New User


Joined: 11 Feb 2008
Posts: 35
Location: Chennai

PostPosted: Tue Feb 09, 2010 1:56 pm    Post subject: Passing and returning a compound variable
Reply with quote

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.'?
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10375
Location: italy

PostPosted: Tue Feb 09, 2010 2:08 pm    Post subject: Reply to: Passing and returning a compound variable
Reply with quote

it cannot be done full stop

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
Back to top
View user's profile Send private message
vasif

New User


Joined: 11 Feb 2008
Posts: 35
Location: Chennai

PostPosted: Tue Feb 09, 2010 2:32 pm    Post subject:
Reply with quote

Thank you enrico for the quick response.

So can i conclude that the below code cant be realised at all in rexx
Code:

call sub stem1.
call sub stem2.

and expect stem1 and stem2 to have a list of 1 to count each?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10375
Location: italy

PostPosted: Tue Feb 09, 2010 2:34 pm    Post subject: Reply to: Passing and returning a compound variable
Reply with quote

that' s exactly what I told You. icon_evil.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
This topic is locked: you cannot edit posts or make replies. ISREDIT Macro is not returning back t... nico_neoz CLIST & REXX 21 Sat Nov 18, 2017 7:40 pm
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us