× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi all.
I just wrote something that here at the house (working remote) will not be
appreciated, and no one at work will care or say waste of time. But I
think it will be very helpful.

I just want to share and get your input, did I miss something?

I am always getting the questions about programs, I end up trying to figure
out what it calls and what calls it.

I created an ACS example so it is easy to call up and use.

First create variables to use later. That way I do not have to change it
in the SQL every time. I just change it here and execute the SQL. Ready
for later use.
Second I call the cl command dsppgmref to collect the information. Do this
for all libraries you want to review. I use the 'run from selected' to
make it easy to run all of them. My list has about 15 libraries. Note the
*ADD and *REPLACE options.
The third part produces 'What programs are called by this program'.
The fourth part produces 'What programs call this program'.
The fifth part tells you what files are used by this program.
The sixth part is if you want to see what programs use a file.
The last part is clean up.

Here is my example:
-- category: .SYS
-- description: Program_Call_Stack
-- =========+=========+=========+=========+=========+
-- Create a work variable with search value Change the default and run
both
CREATE OR REPLACE VARIABLE kcrawford2.@vTmpSql01 CHAR(10) DEFAULT
'COBEXPHR' -- Program searching for
;
CREATE OR REPLACE VARIABLE kcrawford2.@vTmpSql02 CHAR(10) DEFAULT
'COBFILE01' -- File searching for
;
-- Build the work file with program reference information.
cl:DSPPGMREF PGM(PgmLib01/*ALL) OUTPUT(*OUTFILE) OBJTYPE(*ALL)
OUTFILE(KCRAWFORD2/@tTmpSql01) OUTMBR(*FIRST *REPLACE);
cl:DSPPGMREF PGM(PgmLib02/*ALL) OUTPUT(*OUTFILE) OBJTYPE(*ALL)
OUTFILE(KCRAWFORD2/@tTmpSql01) OUTMBR(*FIRST *ADD);
;
stop
;
-- =========+=========+=========+=========+=========+
-- What programs are called by this program? What is the call stack?
Select Connect_By_Root whPnam "Program_Name",
Connect_By_Root trim(whPnam) concat
Sys_Connect_By_Path(trim(whFnam)
concat '.'
concat lower(trim(whOtyp))
, ' > ') "Call_Stack"
, Level "Levels"
from kcrawford2.@tTmpSql01
where whFnam not like 'Q%'
and whFnam not like '*%'
and whFnam not like '&%'
and whObjT != 'F'
and whOTyp != '*FILE'
and Connect_By_isCycle = 0
and Connect_By_isLeaf = 0
Start With whPnam = kcrawford2.@vTmpSql01
Connect By NoCycle whPnam = Prior whFnam
and prior whObjT != 'F'
and prior whOTyp != '*FILE'
and prior whFnam != kcrawford2.@vTmpSql01
Order By 2
;
-- =========+=========+=========+=========+=========+
-- What programs call this program?
Select Connect_By_Root whFnam "Program_Name",
Connect_By_Root trim(whFnam) concat
Sys_Connect_By_Path(trim(whPnam)
concat '.'
concat lower(trim(whOtyp))
, ' < ') "Called_By_Stack"
, Level "Levels"
from kcrawford2.@tTmpSql01
where whPnam not like 'Q%'
and whPnam not like '*%'
and whPnam not like '&%'
and whObjT != 'F'
and whOTyp != '*FILE'
and Connect_By_isCycle = 0
and Connect_By_isLeaf = 1
Start With whFnam = kcrawford2.@vTmpSql01
Connect By NoCycle whFnam = Prior whPnam
and prior whObjT != 'F'
and prior whOTyp != '*FILE'
and prior whPnam != kcrawford2.@vTmpSql01
Order By 2
;
-- =========+=========+=========+=========+=========+
-- What files are used by this program?
select whPnam, whFnam, whotyp
from kcrawford2.@tTmpSql01
where whPnam = kcrawford2.@vTmpSql01
and whObjt = 'F'
;
-- =========+=========+=========+=========+=========+
-- What programs are used by this file?
Select whFnam, trim(whPnam) concat '.'
concat lower(trim(
case when whSPkg = 'P' then 'Pgm'
when whSPkg = 'S' then 'SQLPkg'
when whSPkg = 'V' then 'SrvPgm'
when whSPkg = 'M' then 'Module'
when whSPkg = 'Q' then 'QryDfn'
else '?'
end)) "Used_by",
whRFnm,
case when whFUsg = 1 then 'I'
when whFUsg = 2 then 'O'
when whFUsg = 3 then 'I/O'
when whFUsg = 4 then 'U'
when whFUsg = 5 then 'I/U'
when whFUsg = 6 then 'O/U'
when whFUsg = 7 then 'I/O/U'
when whFUsg = 8 then 'N/S'
when whFUsg = 0 then 'N/A'
else '?'
end "Usage"
from kcrawford2.@tTmpSql01
where whFnam = kcrawford2.@vTmpSql02
;
stop
;
-- =========+=========+=========+=========+=========+
-- Clean UP
cl:DLTF FILE(KCRAWFORD2/@tTmpSql01);
cl:DLTSRVPGM SRVPGM(KCRAWFORD2/@vTmpSql01);
cl:DLTSRVPGM SRVPGM(KCRAWFORD2/@vTmpSql02);
;
stop
;



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.