View previous topic :: View next topic |
Author |
Message |
sumithar Beginner
Joined: 22 Sep 2006 Posts: 84 Topics: 29
|
Posted: Wed Dec 18, 2013 5:13 pm Post subject: Stem variable in EXECIO |
|
|
Since I couldn't figure out how to pass stem variables from a subroutine to calling program, I adopted a rather crude technique. In the subroutine I write to queue and in the main program I pull and write into a stem variable. Also, the value returned by the subroutine is the number of items written into the Queue. This is how my code looks.
Code: |
countvar = whichtab('parm1' 'parm2')
do i = 1 to countvar
parse pull var1
outputstem.i = var1
end
countvar1 = whichtab('parm3' 'parm4')
do i = 1 to countvar1
parse pull var1
j = countvar + i
outputstem.j = var1
end
do k = 1 to (countvar + countvar1)
say outputstem.k
end
ADDRESS TSO
"ALLOC FI("FILENAM") TRACKS SPACE(1,1) UNIT(SYSDA) NEW DSORG(PS)" ,
"LRECL(132) RECFM(F,B) BLKSIZE(23364) REU"
"EXECIO * DISKW "FILENAM" (FINIS STEM OUTPUTSTEM."
ADDRESS ISPEXEC "LMINIT DATAID(IDVAR) DDNAME("FILENAM")"
ADDRESS ISPEXEC "VIEW DATAID("IDVAR")"
ADDRESS ISPEXEC "LMFREE DATAID("IDVAR")"
|
The puzzle I am having is that when I display the contents of the stem variable using the do loop, all the data from both the calls is displayed.
But the file output shows only the data returned from the first call even tho the same stem variable is being used there as well.
Wonder if any insights on where I am messing up?
Thanks! |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Wed Dec 18, 2013 5:43 pm Post subject: |
|
|
Try your DISKW with countvar + countvar1 instead of *. Using * is a no-no. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12373 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
sumithar Beginner
Joined: 22 Sep 2006 Posts: 84 Topics: 29
|
Posted: Thu Dec 19, 2013 10:07 am Post subject: |
|
|
Nic,
Thanks for that tip. I guess there must have been a Null line somewhere in there.
Kolusu,
I will be happy to provide you with a list of URLs I browsed about passing stem variables between external subroutines last morning! I saw references to using CBT stuff and INTERPRET commands and IKJCT441 and what not and decided it was too much for me. There was a post on some forum that recommended I should use QUEUE(). Unfortunately that's all it said, Use QUEUE(), so I had to take a stab at how to use it!
My googling didn't reveal these links you cited above, I'll take a look there- thanks for providing them |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12373 Topics: 75 Location: San Jose
|
Posted: Thu Dec 19, 2013 10:39 am Post subject: |
|
|
sumithar wrote: | Nic,
Thanks for that tip. I guess there must have been a Null line somewhere in there.
Kolusu,
I will be happy to provide you with a list of URLs I browsed about passing stem variables between external subroutines last morning! I saw references to using CBT stuff and INTERPRET commands and IKJCT441 and what not and decided it was too much for me. There was a post on some forum that recommended I should use QUEUE(). Unfortunately that's all it said, Use QUEUE(), so I had to take a stab at how to use it!
My googling didn't reveal these links you cited above, I'll take a look there- thanks for providing them |
Sumithar,
I guess some of the links are expired. Sorry about that. STEMPULL and STEMPUSH are assembler routines and can be found at CBTTAPE, but I guess you don't need that sophisticated stuff. Did you try GLOBAL and GLOBAL(V) link? |
|
Back to top |
|
|
sumithar Beginner
Joined: 22 Sep 2006 Posts: 84 Topics: 29
|
Posted: Mon Dec 23, 2013 1:19 pm Post subject: |
|
|
kolusu wrote: | sumithar wrote: | Nic,
Thanks for that tip. I guess there must have been a Null line somewhere in there.
Kolusu,
I will be happy to provide you with a list of URLs I browsed about passing stem variables between external subroutines last morning! I saw references to using CBT stuff and INTERPRET commands and IKJCT441 and what not and decided it was too much for me. There was a post on some forum that recommended I should use QUEUE(). Unfortunately that's all it said, Use QUEUE(), so I had to take a stab at how to use it!
My googling didn't reveal these links you cited above, I'll take a look there- thanks for providing them |
Sumithar,
I guess some of the links are expired. Sorry about that. STEMPULL and STEMPUSH are assembler routines and can be found at CBTTAPE, but I guess you don't need that sophisticated stuff. Did you try GLOBAL and GLOBAL(V) link? |
Hi,
Unfortunately, the global link is broken
http://www.wjensen.com/WJTECH/mypgm/rexxglobalvars.html
The GlobalV talks about Netview and Tivoli products- do I need those to be available on my system to use it?
May I ask a follow up question... not directly related to my original one but a problem I have run into with the script. As you can see there is a parse pull command after the call to the subroutine to retrieve the variables the subroutine has written into the stack.
When I run the script it's forcing me to hit the Enter key for each pull command. Is this something I'm doing wrong?
Thanks for indulging me
Regards
As you |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12373 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
sumithar Beginner
Joined: 22 Sep 2006 Posts: 84 Topics: 29
|
Posted: Mon Dec 23, 2013 5:17 pm Post subject: |
|
|
OK, I will definitely look up those links.
In the meantime...this is the relevant snippet of my script. Prior to this snippet I have read an input dataset member into a stem variable, IREC., and am processing it sequentially.
Code: | do jj = 1 to IREC.0
parse var IREC.jj CMD DBRMMOD
if CMD = 'DBRM' then do
dbrmcount = dbrmcount + 1
DBRMMOD = strip(DBRMMOD,b)
ISPEXEC CONTROL NONDISPL ENTER
countvar= whichtab(dbrmmod 'VWUT3')
do i = 1 to countvar
pull var1
outputstem.k = var1
k=k+1
end
end
end |
When it executes the "pull var1" the first time after a call to the subroutine (whichtab), it needs an "enter" key- there is no need to hit "enter" for subsequent "pull"s for that subroutine call. So if it calls the subroutine 4 times, I am made to hit Enter 4 times.
If you think I'd be better off reading those links rather than spending time on this approach- feel free to tell me so!
Thanks! |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Thu Jan 02, 2014 3:09 pm Post subject: |
|
|
If you have to press enter for a pull then that would mean that you don't have anything in queue. Check you logic again. _________________ Regards,
Diba |
|
Back to top |
|
|
sumithar Beginner
Joined: 22 Sep 2006 Posts: 84 Topics: 29
|
Posted: Fri Jan 03, 2014 1:45 pm Post subject: |
|
|
Thanks, you pointed me in right direction. The number of queued entries is one less than the value I was returning. So my loop counter should have been countvar - 1. |
|
Back to top |
|
|
|
|