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

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


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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: 1306
Location: Vilnius, Lithuania

PostPosted: Mon Nov 02, 2009 2:14 pm
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: 8797
Location: Welsh Wales

PostPosted: Mon Nov 02, 2009 2:51 pm
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: 1306
Location: Vilnius, Lithuania

PostPosted: Mon Nov 02, 2009 3:03 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Nov 02, 2009 3:55 pm
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
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

Global Moderator


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

PostPosted: Mon Nov 02, 2009 10:15 pm
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Nov 02, 2009 10:22 pm
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
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

Global Moderator


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

PostPosted: Tue Nov 03, 2009 7:44 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
Search our Forums:

Back to Top