MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Stem variable in EXECIO

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
sumithar
Beginner


Joined: 22 Sep 2006
Posts: 84
Topics: 29

PostPosted: Wed Dec 18, 2013 5:13 pm    Post subject: Stem variable in EXECIO Reply with quote

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
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Dec 18, 2013 5:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Wed Dec 18, 2013 6:26 pm    Post subject: Reply with quote

sumithar,

Please search before posting. Check the following links

http://www.mvsforums.com/helpboards/viewtopic.php?p=58501

http://www.mvsforums.com/helpboards/viewtopic.php?t=7966
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sumithar
Beginner


Joined: 22 Sep 2006
Posts: 84
Topics: 29

PostPosted: Thu Dec 19, 2013 10:07 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Thu Dec 19, 2013 10:39 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
sumithar
Beginner


Joined: 22 Sep 2006
Posts: 84
Topics: 29

PostPosted: Mon Dec 23, 2013 1:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Mon Dec 23, 2013 1:44 pm    Post subject: Reply with quote

sumithar,

The GLOBAL V and GLOBAL GET are explained here

http://pic.dhe.ibm.com/infocenter/tivihelp/v3r1/index.jsp?topic=%2Fcom.ibm.itnetviewforzos.doc_5.2%2Fdqcl2ms2166.htm

http://pic.dhe.ibm.com/infocenter/tivihelp/v3r1/index.jsp?topic=%2Fcom.ibm.itnetviewforzos.doc_5.2%2Fdqcl2ms2168.htm
sumithar wrote:

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?


Not Sure what the script is , so I am making an educated guess that you are passing the parms in loop and it expects you press ENTER. Try coding

Code:

ISPEXEC CONTROL NONDISPL ENTER


and see if that works.

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sumithar
Beginner


Joined: 22 Sep 2006
Posts: 84
Topics: 29

PostPosted: Mon Dec 23, 2013 5:17 pm    Post subject: Reply with quote

kolusu wrote:
sumithar,

The GLOBAL V and GLOBAL GET are explained here

http://pic.dhe.ibm.com/infocenter/tivihelp/v3r1/index.jsp?topic=%2Fcom.ibm.itnetviewforzos.doc_5.2%2Fdqcl2ms2166.htm

http://pic.dhe.ibm.com/infocenter/tivihelp/v3r1/index.jsp?topic=%2Fcom.ibm.itnetviewforzos.doc_5.2%2Fdqcl2ms2168.htm
sumithar wrote:

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?


Not Sure what the script is , so I am making an educated guess that you are passing the parms in loop and it expects you press ENTER. Try coding

Code:

ISPEXEC CONTROL NONDISPL ENTER


and see if that works.

Kolusu


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
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 699
Topics: 63
Location: USA

PostPosted: Thu Jan 02, 2014 3:09 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
sumithar
Beginner


Joined: 22 Sep 2006
Posts: 84
Topics: 29

PostPosted: Fri Jan 03, 2014 1:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group