Find Protypes in Programs

20 pts.
How can I find all programs that a Prototype is defined in regardless of source file or source library?

Answer Wiki

Thanks. We'll let you know when a new response is added.

By responding with a really stupid response, others will have an opportunity to swoop down and …

All I can think of is scanning the sources for the name of the prototype and/or copy books that contain the prototype.

I don’t think their is a IBM map of the prototypes.

Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • astradyne
    There are a number of different answers available depending on exactly what the original poster wants to do and how things are setup within his/her organisation. For example, how would you answer the following questions:
    1. Are you looking for the prototype of a particular procedure or all prototypes?
    2. Are you only interested in sub-procedure prototypes, external program prototypes or both?
    3. Are prototypes held centrally in copybooks, hard coded in program source or is there a mixture?
    As Philpl1jb answered, the easiest way is to scan the source for relevant entries. Depending on how you answer the above questions, you can limit the source files you scan and the positions of the source line to search through. For example, if you're looking for all prototypes then searching for "pr" in positions 24 and 25 would suffice. Similarly searching for "EXTPGM" or the program name in positions 44 to 79 would assist in finding external program prototypes. I do have a utility, including source, at which builds a cross reference table of programs / service programs / modules / files / objects / etc for a specified library which may help. If you're open to a spot of programming, the QBNLMODI system API will return procedure names in the MODL0300 format and the utility could easily be modified to identify procedure names for each module it identifies. If I get time I'll add it in, but it's not likely for a month or two. Regards Jonathan
    370 pointsBadges:
  • wmfsr
    The specifics of what I am attempting to do are as follows: My requirement is to analyze existing programs within applications and determine what is required to disconnect the program(s) and remove to an archieve all relevant objects that are no longer required. For the sake of this discussion, I will refer to programs collectively as a job. Because of the global scope of objects that can be included in a job, I have a need to identify any object used in the job, which library contains the object, which file/library contain the source, if applicable, and where is the object being used by other jobs. My mandate requires that I make recommendations as to how to disconnect the job and which objects can be disconnected along with the job. First, there are many tools that can be purchased that cross reference objects, but that is not an option. Second, certain cross references exist in the current environment that provide some cross reference capability. Third, I also have some cross reference tools that I have begged, borrowed, written that I use. One of them is the "Where's the source" written by Jeff Worthington 0n 9/10/02 that I use to build a cross reference table over all user libraries that gives me a single file with source Files/Members/Libraries information. A simple SQL or Query will allow me to list all locations of a single source member. In this particular instance I cannot answer the question of how the prototypes are defined. Some of them are hard coded in a program, some of them are defined as copy members in multiple source files copied into the prrogrms. I can't include only *EXPORT ot *IMPORT or *PROCLIST or Service program *PROCEXP in my search or scan. I can scan sourcemembers in source files, but how do I determine that an "EVAL" statement executes a call to a Prototyped Procedure? At this point in time, I do not have the time or the customer's mandate to explore write programming that will permit this type of cross-referencing. I ask the question to see if anyone has developed a simple way to cross-reference this type of object and it's use, location and references all collected into a single file. Your questions are all good, I hope that this explains what I am attempting to accomplish. Given a sufficient amount of time, I could build some cross referencing product that would identify all sources of Prototyped procedures by building a series of programs to collect this information. but at the moment, i do not see that IBM has created and maintains this information in any files such as the DB2's cross reference files like QADBXREF, QADBFDEP, QADBIFLD, and etc. Bill F
    20 pointsBadges:
  • TomLiotta
    To search source (which would seem to be mostly a waste of time), make sure you not only catch /COPY members but also "/copy" and maybe "/Copy", and don't forget that they may be nested up to 2048 levels deep. And /INCLUDE (and /include...). And source in IFS streamfiles. First make sure that you locate all source files; that's relatively easy fortunately. (Streamfile source is a bit trickier.) Then figure out some way to recognize which members are RPG IV while ignoring RPG II and III, and, of course, CL, REXX, C SQL and everything else that might have characters in positions that you might be checking. (Finding "PR", "Pr" or "pr" in particular columns might not help much -- they could simply be part of the word 'print' in a comment.) Note that the PDM member type has no necessary relationship. If you're sure it's RPG IV, you can search for a name that may occur anywhere within positions 7 thru 23 or from 52 thru 78 depending on how spacing is supplied and how long the name is. Case sensitivity will be a potential pitfall. You'll then need to identify that it's a procedure prototype rather than some constant, comment or something else. And don't forget that it can be on a continuation line. Be aware that conditional compiler directives might choose which prototype is copied. Also be aware that a prototype may define a program or a procedure. If it's a program, the name may be elsewhere in a variable. If it's a procedure prototype, it might not be a name -- it might be a procedure pointer instead. In short, if you're going to try to process source statements to identify prototypes, be prepared to write a significant part of a batch RPG compiler since it will be processing a large number of input members, unless it doesn't matter if things are missed. Tom
    125,585 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: