|
|
| Author |
Message |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 143
|
|
|
|
Hi,
Program A is calling sub program B twice. Since Program 'B' is in Inital the Local-storage values remains the same when program 'A' calls Program 'B' second time.
What are all the possibilities to convert Program 'B' non-initial
apart from recompiling Program 'B'. (i.e. without changing Program 'B').
Please let me know.
Thanks,
Murali. |
|
| Back to top |
|
 |
References
|
|
 |
Bill O'Boyle
Active Member
Joined: 14 Jan 2008 Posts: 983 Location: South Carolina, USA
|
|
|
|
Remove "PROGRAM IS INITIAL" from the PROGRAM-ID clause?  |
|
| Back to top |
|
 |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 143
|
|
|
|
| I agree it will help, but my scenario is not to touch the Program 'B'. I feel 'CANCEL' will help... |
|
| Back to top |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 3385 Location: germany
|
|
|
|
pkmurali,
you have everything ass-backwards.
INITIAL and CANCEL have the same effect. |
|
| Back to top |
|
 |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 143
|
|
|
|
Dick Brenholtz
I am using a existing COBOL Program in my project(similar to Program 'B' mentioned in the previous post) which retains it's local storage variables, i can't able to find the keyword 'INITIAL' or 'CANCEL' used in the program.Since we use Endevor the compiling details are not available. Please let me know what should be done to make that program non-initial.
Thanks,
Murali. |
|
| Back to top |
|
 |
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 256 Location: chennai
|
|
|
|
| pkmurali wrote: |
Hi,
Program A is calling sub program B twice. Since Program 'B' is in Inital the Local-storage values remains the same when program 'A' calls Program 'B' second time.
What are all the possibilities to convert Program 'B' non-initial
apart from recompiling Program 'B'. (i.e. without changing Program 'B').
Please let me know.
Thanks,
Murali. |
AFAIK INITIAL clause causes the variables to be 'refreshed'. i.e. the variables WILL NOT retain the values from the previous call.
According to my understanding, Using INITIAL in the called program and using CANCEL before calling the subprogram in the calling program yields the same effect. Is there really a need to change anything?? |
|
| Back to top |
|
 |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 143
|
|
|
|
| My objective is to make the program 'B' to be non-initial without touching the program 'B'. Is it possible? |
|
| Back to top |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 3385 Location: germany
|
|
|
|
does program b have PROGRAM IS INITIAL in the PROGRAM-ID clause?????
if not, then your objective has been obtained - without action.
If Program b has the INITIAL phrase in the PROGRAM-ID clause,
then you have to change Program b.
you said that there are no CANCEL Program b instructions in Program a,
so that is not an issue. |
|
| Back to top |
|
 |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 143
|
|
|
|
does program b have PROGRAM IS INITIAL in the PROGRAM-ID clause?????
NO
if not,
then if there are no CANCEL Program b instructions in Program a,
then program b's working-storage,
will
on subsequent CALLs,
have the same values as when exited on the previous invocation.
No Cancel statement coded |
|
| Back to top |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 3385 Location: germany
|
|
|
|
| then you do not have a problem. and you don't need to take any action. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 3385 Location: germany
|
|
|
|
I have overlooked the possibility that Program b executes INITIALIZE instructions.
Does Program b initialize all of its working-storage via INITIALIZE instructions? |
|
| Back to top |
|
 |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 143
|
|
|
|
I have xpedited the subprogram, where WS-END-OF-CB002003 is the working storage variable.
This is the first call...
| Code: |
COMMAND ===> SCROLL ===> CSR
BEFORE BREAKPOINT ENCOUNTERED
-
000067 K 05 WS-END-OF-CB002003 > N
----+----1----+----2----+----3
MORE-> 01 LK-ECA-HEADER > ..............................
----+----1----+----2----+----3
------ ----------------------------------------- Before R243B002/AMODE 31 <>
000826 ******************** 0114
=====> B PROCEDURE DIVISION USING LK-ECA-HEADER 0116
000828 LK-R243B002-DATA-IN 0117
000829 LK-R243B002-DATA-OUT. 0117
000830 ******************** 0118
000831 * 0119
000832 DSNSQL SECTION.
|
This the status at the end of the sub program...
| Code: |
COMMAND ===> SCROLL ===> CSR
BEFORE BREAKPOINT ENCOUNTERED
-
000067 K 05 WS-END-OF-CB002003 > Y
** END **
------ ------------------------------------- Before R243B002:958/AMODE 31 <>
000957 0000-MAINLINE-EXIT. 0149
=====> B GOBACK. 0150
000959 / 0151
000960 1000-INITIALIZATION. 0152
000961 MOVE '1000-INITIALIZATION' TO WS-PARAGRAPH-NM. 0153
000962 0154
000963 * TEMPORARY TABLE DECLARATION 0154
|
this the second call.. where the value of WS-END-OF-CB002003 remains the same 'Y' (retaining the value after the first call).
| Code: |
COMMAND ===> SCROLL ===> CSR
PROGRAM: R243B002 MODULE: R243B002 COMP DATE: 09/17/2002 COMP TIME:14:56:25
-
000067 K 05 WS-END-OF-CB002003 > Y
----+----1----+----2----+----3
MORE-> 01 LK-ECA-HEADER > ..............................
----+----1----+----2----+----3
------ ----------------------------------------- Before R243B002/AMODE 31 <>
000826 ******************** 0114
=====> B PROCEDURE DIVISION USING LK-ECA-HEADER 0116
000828 LK-R243B002-DATA-IN 0117
000829 LK-R243B002-DATA-OUT. 0117
000830 ******************** 0118
000831 * 0119
000832 DSNSQL SECTION.
000833 SQL-SKIP.
000834 GO TO SQL-INIT-END.
|
The Sub program doesn't contain 'INITIAL' or the calling program doesn't have 'CANCEL' statement. Please let me know what should be done to refresh the value for WS-END-OF-CB002003. I am not supposed to change the Sub-Program.
Thanks,
Murali. |
|
| Back to top |
|
 |
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 4223 Location: Atlanta, GA
|
|
|
|
Is the sub program statically called or dynamically called? If it is statically called, change your calling program to make it a dynamic call.
Use CANCEL after returning from the subprogram -- but note that this verb only works on dynamically called routines. |
|
| Back to top |
|
 |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 143
|
|
|
|
To Addwith,
The Sub program is treated as Stored Procedure in earlier application, but i am using it as BatchLoad. Sub-Program can be called as Stored Procedure as well as Batch Program.
Thanks,
Murali. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 3385 Location: germany
|
|
|
|
now I understand the problem.
some jerk coded a stored procedure,
knowing that it would not be re-invoked during the task,
and laid crap code so that it is not re-entrant.
you are screwed Murali,
as Robert said, you can only CANCEL dynamically CALLed modules,
so your process must eat the overhead created by CANCELing and reLOADing the module for each invocation. |
|
| Back to top |
|
 |
|
|