| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| vspangtey Beginner
 
 
 Joined: 13 Jun 2003
 Posts: 7
 Topics: 3
 
 
 | 
			
				|  Posted: Fri Oct 31, 2003 5:47 am    Post subject: How to cancel a static CALL. |   |  
				| 
 |  
				| Hi all, 
 I am facing a problem while giving a second static call to a subroutine. Actually when I am calling the subroutine for the first time one switch is being set in the subroutine. And when I am calling it again it is not giving the desired results as the switch is already being set.
 Is their any way to call a fresh copy of that subroutine in which the switch will have its intial value.
 I tried the command CANCEL 'program-name'  before the second call but it is not working. I think this command used is to get a fresh copy for dynammic call.
 I am looking forward for your valuable advise.
 
 Thanks and Regards,
 Vineet.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Fri Oct 31, 2003 6:46 am    Post subject: |   |  
				| 
 |  
				| vspangtey, 
 
 code INITIAL on the program-id of the subprogram and it will be in initial state for every call
 
 
 Hope this helps...
 
 cheers
 
 kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| slade Intermediate
 
 
 Joined: 07 Feb 2003
 Posts: 266
 Topics: 1
 Location: Edison, NJ USA
 
 | 
			
				|  Posted: Fri Oct 31, 2003 3:23 pm    Post subject: |   |  
				| 
 |  
				| Hi Vineet, 
 I don't get it. If the code has 1st time logic in it, I guess that's the way it's supposed to work. I'm assuming this sub module is used by others, so changing its intent may not be a good idea.
 
 However, if you have a need to use it differently as you outlined, you may want to call it dynamically and then use cancel to re-init it between calls.
 
 Regards, Jack.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| vspangtey Beginner
 
 
 Joined: 13 Jun 2003
 Posts: 7
 Topics: 3
 
 
 | 
			
				|  Posted: Fri Oct 31, 2003 11:40 pm    Post subject: |   |  
				| 
 |  
				| Hi, 
 The subroutine is a standard program and it is running in the production. So, its not possible to change the subroutine and as Jack said it is used by other modules also. The way of calling the program is also unique and it always being called statically. Its because of the requirement that I have to call it twice.
 I was looking for some alternative way so that it won't hurt the standards followed.
 Thanks to all for ur help.
 
 Regards,
 Vineet.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| slade Intermediate
 
 
 Joined: 07 Feb 2003
 Posts: 266
 Topics: 1
 Location: Edison, NJ USA
 
 | 
			
				|  Posted: Sat Nov 01, 2003 2:24 pm    Post subject: |   |  
				| 
 |  
				| Hi Vineet, 
 Why don't you talk to The Powers That Be and explain the situation to them. They may allow you to do Dynamic calls with an intervening cancel. Or they may have a "workaround" that you can use.
 
 I find it hard to beleive that they have newver faced the need to reinit a subpgm before.
 
 Regards, Jack.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| haatvedt Beginner
 
 
 Joined: 14 Nov 2003
 Posts: 66
 Topics: 0
 Location: St Cloud, Minnesota  USA
 
 | 
			
				|  Posted: Fri Nov 14, 2003 10:08 pm    Post subject: |   |  
				| 
 |  
				| Vineet,    why not just add code to the subroutine to initialize all the fields that have to be initialized every time the program is executed ?   this is usually standard procedure for writing a reusuable subroutine. 
 It is very bad form to use the cancel verb, as it deallocates the storage and then the subsequent call has to allocate the storage again.  This adds a considerable overhead to a process which may call the subroutine millions of times (we have many common subroutines like this).
 
 As a general rule I would recommend that you only use the "CANCEL" verb for a module which is ONLY called once during a run unit. With today's virtual storage management in Z/OS or OS/390 this benefits of doing this are usually very small. I would also recommend that you NOT use the "INITIAL" phrase on the PROGRAM-ID statement, as this is usually counter productive.
  _________________
 Chuck Haatvedt
 
 email  -->  clastnameatcharterdotnet
 
 (replace lastname, at, dot  with appropriate
 characters)
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| neilxt Beginner
 
 
 Joined: 01 Mar 2004
 Posts: 23
 Topics: 1
 
 
 | 
			
				|  Posted: Wed May 12, 2004 4:44 pm    Post subject: |   |  
				| 
 |  
				|  	  | Quote: |  	  | am facing a problem while giving a second static call to a subroutine. Actually when I am calling the subroutine for the first time one switch is being set in the subroutine. And when I am calling it again it is not giving the desired results as the switch is already being set.
 Is their any way to call a fresh copy of that subroutine in which the switch will have its intial value.
 I tried the command CANCEL 'program-name' before the second call but it is not working. I think this command used is to get a fresh copy for dynammic call.
 I am looking forward for your valuable advise.
 
 | 
 I've read the thread through and the consensus answer seems to be "it depends what you're actually trying to do". Can you be more specific about why you need it to operate differently than everybody else who uses it?
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |