Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Problem due to 'INITIAL' in Sub Program
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Thu Jul 02, 2009 7:39 pm    Post subject: Problem due to 'INITIAL' in Sub Program
Reply with quote

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

Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Jul 02, 2009 7:52 pm    Post subject: Reply to: Problem due to 'INITIAL' in Sub Program
Reply with quote

Remove "PROGRAM IS INITIAL" from the PROGRAM-ID clause? icon_rolleyes.gif
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Thu Jul 02, 2009 7:54 pm    Post subject:
Reply with quote

I agree it will help, but my scenario is not to touch the Program 'B'. I feel 'CANCEL' will help...
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 02, 2009 7:56 pm    Post subject:
Reply with quote

pkmurali,

you have everything ass-backwards.

INITIAL and CANCEL have the same effect.
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Fri Jul 03, 2009 11:31 am    Post subject:
Reply with quote

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

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Fri Jul 03, 2009 1:49 pm    Post subject: Re: Problem due to 'INITIAL' in Sub Program
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Fri Jul 03, 2009 4:49 pm    Post subject: Reply to: Problem due to 'INITIAL' in Sub Program
Reply with quote

My objective is to make the program 'B' to be non-initial without touching the program 'B'. Is it possible?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jul 03, 2009 4:56 pm    Post subject:
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Fri Jul 03, 2009 5:00 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jul 03, 2009 5:02 pm    Post subject:
Reply with quote

then you do not have a problem. and you don't need to take any action.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jul 03, 2009 5:05 pm    Post subject:
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Fri Jul 03, 2009 7:29 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Fri Jul 03, 2009 7:41 pm    Post subject:
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Fri Jul 03, 2009 7:42 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jul 03, 2009 7:56 pm    Post subject:
Reply with quote

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
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Fri Jul 03, 2009 8:08 pm    Post subject:
Reply with quote

To be more specific,

I have coded Program 'A1' which calls Program 'A2' and Program 'A2' calls Program 'B' all are dynamic calls, after one invocation by Program 'A1' if i cancel Program 'B' will it initialize WS-END-OF-CB002003.

The syntax must be
CANCEL (IDENTIFIER-1,
lITERAL-11....)

Please suggest the above approach is correct or not.

Thanks,
murali.
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Fri Jul 03, 2009 8:32 pm    Post subject: Reply to: Problem due to 'INITIAL' in Sub Program
Reply with quote

Now It's working Fine.

Thanks Dick Brenholtz and Robert Sample.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jul 03, 2009 8:33 pm    Post subject:
Reply with quote

glad you were able to solve it. Have a good weekend.
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Sat Jul 04, 2009 6:35 pm    Post subject: Reply to: Problem due to 'INITIAL' in Sub Program
Reply with quote

I have one doubt,what could be the chances of the Program 'B' to hold the value which is being stored on first call? whether it could be the compiler option which made the program to do so?

Thanks,
Murali
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Jul 04, 2009 6:56 pm    Post subject:
Reply with quote

what you are asking is
'if a compiler option would override the existence or non-existence of the INITIAL phrase in the PROGRAM-ID clause'.

I don't think so.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts A sample of exit program for exit XMN... lind sh CICS 2 Mon Oct 03, 2016 5:07 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us