View previous topic :: View next topic
|
Author |
Message |
r2k1984
New User
Joined: 21 Jun 2005 Posts: 69 Location: chennai
|
|
|
|
HI,
I have a requirement to get all the programs which are called from the main program .
I need to do this activity for more than 10000 programs. So I thought rexx would be useful in this.
Can any one suggest a way to find the calling programs in cobol.
Like progarm a is calling b,c,d
I need to find out the b,c and d. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
r2k1984 wrote: |
... So I thought rexx would be useful in this... |
And your thoughts were based on what? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
And if A calls B which calls C which then calls D ............ |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Or, in PL/I notation, if the name of the called program is variable || 'A' or variable || 'Q'? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
static or dynamic calls...
for static calls the best thinis to use the ISPF member parts list
no reason to reinvent the wheel
the mamber parts list application will cross reference for many languages
the static calls and the copy/includes
You can get the output output in browse mode or as a file ( condensed format ) and afterwards process it to obtain the output in any way You want |
|
Back to top |
|
|
mtaylor
Active User
Joined: 20 Feb 2009 Posts: 108 Location: Kansas City
|
|
|
|
It's a simple thing to write a program that scans a Cobol program for the text 'CALL' and then grab the next token as the called subroutine name. But this approach has problems. A few questions you should ask:
What if subroutine names are stored in working storage?
What if subroutine names are loaded from a file and stored in a table?
Plus many more questions of the form 'what if the called program is dynamically determined at run time?'
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
Quote: |
I have a requirement to get all the programs which are called from the main program .
I need to do this activity for more than 10000 programs. So I thought rexx would be useful in this. |
It is not clear if you are analyze the main program or many programs.
Can you give examples of the CALL statements?
Can you use ISPF option 3.15 and search for 'CALL WORD'? In my own source code (not cobol), I just noticed I have many 'CALL' in comments, so many false positives. You may need to write rexx code to remove those from the list. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
ramakrishnan: hopefully you're starting to understand that if there are dynamic calls being used, it is not possible to determine just by inspection all of the called modules. You can identify the static calls but since a subprogram name can be passed from a file or table to the program while it is running, there's no simple way to determine all called modules for dynamic calls as they may not be known until run time. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
[quote="Pedro"]
Quote: |
In my own source code (not cobol), I just noticed I have many 'CALL' in comments, so many false positives. |
When I search for called programs in COBOL source, I use
Code: |
x all;f ' call ' all |
then exclude the comments and debugging lines. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
This might not be of much help in the current case, but when I am working on a new application, I like to add a trace capability; at the minimum, a write statement for 'Starting program abc'.
Sorry, I do not know COBOL or LE... but might there not already be a trace capability? |
|
Back to top |
|
|
|