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
 

 

How to find all the called program in cobol program by rexx

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
r2k1984

New User


Joined: 21 Jun 2005
Posts: 69
Location: chennai

PostPosted: Mon Nov 02, 2009 10:33 am    Post subject: How to find all the called program in cobol program by rexx
Reply with quote

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

prino

Senior Member


Joined: 07 Feb 2009
Posts: 1002
Location: Oostende, Belgium

PostPosted: Mon Nov 02, 2009 2:14 pm    Post subject: Re: How to find all the called program in cobol program by r
Reply with quote

r2k1984 wrote:
... So I thought rexx would be useful in this...


And your thoughts were based on what?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Nov 02, 2009 2:51 pm    Post subject:
Reply with quote

And if A calls B which calls C which then calls D ............
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1002
Location: Oostende, Belgium

PostPosted: Mon Nov 02, 2009 3:03 pm    Post subject:
Reply with quote

Or, in PL/I notation, if the name of the called program is variable || 'A' or variable || 'Q'?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Mon Nov 02, 2009 3:55 pm    Post subject: Reply to: How to find all the called program in cobol progra
Reply with quote

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

Active User


Joined: 20 Feb 2009
Posts: 108
Location: Kansas City

PostPosted: Mon Nov 02, 2009 5:46 pm    Post subject:
Reply with quote

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

Senior Member


Joined: 01 Sep 2006
Posts: 2033
Location: Silicon Valley

PostPosted: Mon Nov 02, 2009 10:15 pm    Post subject: Reply to: How to find all the called program in cobol progra
Reply with quote

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

Global Moderator


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

PostPosted: Mon Nov 02, 2009 10:22 pm    Post subject:
Reply with quote

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

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon Nov 02, 2009 10:28 pm    Post subject: Re: Reply to: How to find all the called program in cobol pr
Reply with quote

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

Senior Member


Joined: 01 Sep 2006
Posts: 2033
Location: Silicon Valley

PostPosted: Tue Nov 03, 2009 7:44 am    Post subject: Reply to: How to find all the called program in cobol progra
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm


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