If I have a service program with a single module which contains three sub-procedures. Is there a way to programmatically find the usages of the individual sub-procedures within a library/file?
So something like this:
MYLIB/MYSRVPGM <-- My service program object
PROC1 <-- My first sub-procedure
PROC2 <-- My second sub-procedure
PROC3 <-- My third sub-procedure
Then I have an ILE program which uses PROC1
and PROC3
but not PROC2
.
MYLIB/MYPGM <-- My ILE program object which uses PROC1 and PROC3
I'm looking for a way to search for PROC1
or PROC3
and see the result of MYLIB/MYPGM
returned. However a search for PROC2
should not return a result.
So far, I've tried using DSPPGMREF
, but that only returns the overall object (IE: MYLIB/MYSRVPGM
), not the individual sub-procedures used.
Another route I've ventured was using FNDSTRPDM
but that's just scanning the source for the string PROC1
. It could be in a comment and return a false positive.
I know third-party tools exist for this, but they are not viable options at the moment due to cost. Free or relatively cheap ones may be an option though (I'm just not aware of any). Am I out of luck?
If you have the modules for the programs, you could use the List Module Information (QBNLMODI) API to get a list of the module imports. https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/apis/qbnlmodi.htm