IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Identifying the main program thru sub program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Madhu Reddy

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Fri Mar 02, 2007 10:03 am
Reply with quote

Hi,

I have sub programs , i am getting the input to this sub program thru the
linkage section, how to identify the main program ?

Could you please answer as early as possible.
Thanks
Back to top
View user's profile Send private message
vicky10001
Warnings : 1

Active User


Joined: 13 Jul 2005
Posts: 136

PostPosted: Fri Mar 02, 2007 11:41 am
Reply with quote

You need to search subprogram into cobol Library.

You will get main program otherwise You search bindeck also
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Mon Mar 05, 2007 10:22 pm
Reply with quote

do you need to identify the main program thru subprogram itself or you need to find out manualy. For the second one you need to go for library check
Back to top
View user's profile Send private message
dineshness

New User


Joined: 25 Dec 2006
Posts: 63
Location: Perambalur

PostPosted: Tue Mar 06, 2007 1:02 am
Reply with quote

May be you can pass the main program name as a string to the Sub program thru the linkage section.

Dinesh.
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Tue Mar 06, 2007 5:25 pm
Reply with quote

Quote:
Maybe you can pass the main program name as a string to the Sub program thru the linkage section.


...and to do that you would need to identify the main program!
..and to do that you would?????
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Mar 06, 2007 7:44 pm
Reply with quote

That's what we do too:
Code:
01  WS-PARAM-AREA.
    03  WS-CALLING-PROGRAM   PIC X(8).
    03  WS-PARAMETERS ....

MOVE 'mainprogram' TO WS-CALLING-PROGRAM
CALL 'subprogram' USING WS-PARAM-AREA
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Mar 06, 2007 10:48 pm
Reply with quote

Hello,

This will work, but will require changing every program that calls the "subprogram". If the called program is some kind of common subroutine (like a date handling routine) it may be called by hundreds of other modules. Changing all of them may not be feasable.

Back to the original request. . . .

Is there a problem in the subprogram caused by the passed-in data? If so, you could cause the subprogram to abend and find the calling module from the dump. If the problem currently causes an abend, you will already have a dump.
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Tue Mar 06, 2007 11:27 pm
Reply with quote

reddy for what purpose you are looking for name of main module do you need any logical things to be performed within your data or just to find which is the main module. what king of call is used in your program is it static or dynamic
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 07, 2007 12:48 am
Reply with quote

Hello,

To continue with the thought Cobolunni brings up. . .

If you do need to do processing dependng on which module was the "caller", it is time for a new subroutine that has an expanded parameter list (as was described above). This, unless there is the ability to make the change to all of the modules that currently call this subprogram.

If a second subprogram was created, i'd encourage phasing out the original so that 2 of them do not have to be maintained.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Mar 07, 2007 4:25 am
Reply with quote

Don't forget, the parm list can be optionally longer than all the calling programs know about. The called program can test for its presence and act accordingly.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 07, 2007 5:16 am
Reply with quote

As long as the new data is not put first in the parms icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top