View previous topic :: View next topic
|
Author |
Message |
vasan_4u
New User
Joined: 28 Jun 2005 Posts: 35 Location: chennai
|
|
|
|
I have a array called SYM.0 in the main program and I need to pass the array variable to another subroutine.
How can i do this. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the subroutine must be in the same source file,
snippet...
subroutine:procedure expose sym. |
|
Back to top |
|
|
vasan_4u
New User
Joined: 28 Jun 2005 Posts: 35 Location: chennai
|
|
|
|
Yes they are in the same source file.'
This is how I have passed.
Code: |
ADDRESS ISPEXEC "VPUT (DSNSTMT SYM) PROFILE"
CALL DSNPROCS |
This is how i am getting it.
Code: |
ADDRESS ISPEXEC "VGET (DSNSTMT SYM) PROFILE" |
I am not clear with the one you have said earlier. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
maybe Your request was not very clear to me
I inferred that in the main flow You had an array ...
improper term for a stemmed variable
and You wanted to use the same in a subroutine
Code: |
....
sym.0 = 2
sym.1 = "one"
sym.2 = "two"
do i = 1 to sym.0
say "mainprog " i sym.i
end
say "calling mysub"
call mysub
exit
mysub:procedure expose sym.
do i = 1 to sym.0
say "mysub " i sym.i
end
return |
but from Your second post i see that You are passing by using ispf vput service
a simple variable called SYM, not ann array or a stem...
please clarify |
|
Back to top |
|
|
vasan_4u
New User
Joined: 28 Jun 2005 Posts: 35 Location: chennai
|
|
|
|
You are correct I have passed just the SYM as if I was passing the SYM.0 it was throwing me an error using the ISPEXEC.
So I was trying different option.
I tried your way of using the procedure.
First program TEST
Code: |
/**REXX*/
DSNAME.1='&HLQV.SECU.ABCP.DRIVER'
DSNAME.2='&HLQ.&SYS..&JOB..NOTPSTED.REPORT'
DSNAME.3='&HLQV&VER&SYS..POST20.TEMP.LTRQ.CLUSTER'
DSNAME.4='&HLQ.&LSCID..&RCVR.&SNDR.VERI.RESPONSE'
DSNAME.0 = 4
CALL TEST1
EXIT(0)
|
The TEST1 Program
Code: |
/* REXX */
TEST1:PROCEDURE EXPOSE DSNAME.
DO I = 1 TO DSNAME.0
SAY 'DSNAME' DSNAME.I
END
RETURN
|
When i run the TEST program its showing me Error as
2 +++ PROCEDURE EXPOSE DSNAME.
IRX0017I Error running TEST1, line 2: Unexpected PROCEDURE
8 +++ CALL TEST1
I am not sure If I was clear with my question I am sorry. |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Krishna -
As Enrico already said, "the subroutine must be in the same source file", that is - your main routine and your called subroutine should be in the same member in order to use the PROCEDURE instruction (as clearly noted in the fine manual).
If you want to pass arrays to external subroutine, you need to compose your own logic. For this, you can
- Use the QUEUE
- Write to dataset (probably temporary)
- Use VPUT/VGET with INTERPRET
- Concatenate the values into one string with delimiter in between
- Use the variable access routine IKJCT441
etc...
O. |
|
Back to top |
|
|
vasan_4u
New User
Joined: 28 Jun 2005 Posts: 35 Location: chennai
|
|
|
|
As I already mentioned both the TEST and TEST1 member are in the same PDS.
or the main routine and the subroutine are in the same source. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
what we meant was that ...
main and subroutines ( for expose to work ) must be in the same source member
not... different members of the same source PDS |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
If You need to pass stems across rexx scripts, search the net with
"STEMPUSH" and/or "STEMPULL" |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
You know, this is the second post by this O/P on this same topic. All of these answers were given the first time too.
I really don't get what the big deal is with just writing the data to a temp (VIO) dataset from one exec, and reading it from a different exec or clist. They can go back-and-forth all day long like this. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the other time He was asking about simple variables,
and the VPUT/VGET approach was viable
not the same thing for stem, if the subroutine is getting called
let' s say, for each record read, then the performance would be horrible.. |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Quote: |
not the same thing for stem, if the subroutine is getting called
let' s say, for each record read, then the performance would be horrible.. |
That's a good reason to use an internal subroutine, or to use COBOL with IKJCT441 ....
O. |
|
Back to top |
|
|
vasan_4u
New User
Joined: 28 Jun 2005 Posts: 35 Location: chennai
|
|
|
|
I dont think I have raised the this question in another post of mine. If I misunderdtood I am sorry.
The code that I have showed in here is just a example actually I need to know how to pass the stem variable which will be used in my code which is too big to post here.
thanks for the input I will search for STEMPUSH and PULL |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I need to know how to pass the stem variable which will be used in my code which is too big to post here. |
You might consider making a much smaller bit of code to test passing the variable. Once the test works, incorporate the method that works for you into the main code. |
|
Back to top |
|
|
vasan_4u
New User
Joined: 28 Jun 2005 Posts: 35 Location: chennai
|
|
|
|
Yes I will do that way, but I am not sure how to pass the stem variable across program. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If you build the 2 "test" sets of code (using the suggestions above) and have questins/problems, you could post the small test code and someone would probably have suggestions.
Until you post what you have and what error(s) are presented - or what does not work as you want, it will be difficult for someone to offer specifics. |
|
Back to top |
|
|
|