The first lines of program source named pgm_refs.sql (from https://github.com/SJLennon/IBM-i-RPG-Free-CLP-Code/blob/master/PGM_REFS/pgm_refs.sql#L1) starts with
-- Procedure to run DPSPGMREF, then run DSPPGMREF on each of its objects
-- by calling itself recursively.
-- Result is a file named REFS containing all the objects that
-- DSPPGMREF knows about an object, to an essentially unlimited depth.
-- There are two places you need to change the library name, following
-- a comment like this: -- <<<<<< Change this table library >>>>>>>
CREATE OR REPLACE PROCEDURE PGM_REFS (
IN p_INLIB varCHAR(10)
,IN p_INPGM varCHAR(10)
,IN p_INTYPE varCHAR(10) default '*PGM'
,in p_Depth integer default(0)
)
So, The program accepts four parameters initial library, initial program, initial program type and depth
As to your 1st question my first thought is it will list programs, modules and files per the program definitions. It will not be checking the QCMDEXC commands, though
As to your 2nd question, DSPPGMREF command does not check source files. It checks the compiled objects
As to your 3rd question, CALL MYLIB/Thispgm ('*ALL' , '*ALL' ,'*ALL' ,0' ) will list per the DSPPGMREF help "The information is shown for all programs and query definitions in the library or libraries" , . Keep in mind what objects the user profile has authority to and that probably it will list the operating system programs too. Also I assuming pgm_refs.sql is compiled as thispgm, in library MYLIB
For reference, The 3rd parameter for the progam is type. Type in DSPPGMREF "Specifies the object type for which information is displayed", per the green screen help. DSPPGMREF command accepts "ALL" "*PGM " "*SQLPKG" "*SRVPGM" "*MODULE" and "*QRYDFN" as types
------------------------------
Carlos Romero
------------------------------
Original Message:
Sent: Fri February 09, 2024 12:47 PM
From: jerry ven
Subject: Regarding DSPPGMREF
Thanks for all these suggestions.
1) Does this utility also allow me to get the bound modules list as well, does it allow me to get the list of bound modules from the associated programs and service programs as well?
2) What about the Procedures, Sub procedures and copybooks can we get that information using this utility? or is there any standard IBM i SQL query which can provide this information?
3) To get the information of all the objects to get their references from all the libraries in the system can I run it like CALL MYLIB/Thispgm ('*ALL' , '*ALL' ,'*ALL' ,0' )
Thanks.
Original Message:
Sent: Tue February 06, 2024 10:30 PM
From: Satid Singkorapoom
Subject: Regarding DSPPGMREF
Dear Jerry
Have you tried running this in Run SQL Scripts tool yet? Do not stick to STRSQL because it has many limitations due to the fact that it has not been enhanced for several years now and there is no documentation explaining the difference support between STRSQL and Run SQL Script tool but the latter is definitely superior in all respects. Sometimes when I have a problem running SQL from STRSQL and switch to Run SQL Script tool, it solves the issue.
------------------------------
Chance favors only the prepared mind.
-- Louis Pasteur
------------------------------
Satid S.
Original Message:
Sent: Tue February 06, 2024 10:20 AM
From: jerry ven
Subject: Regarding DSPPGMREF
Yes just tried without commas as well now the error is with message ID SQL0104:-"Token 'mypgm'(the program whose references I have been trying to find out) was not valid. Valid tokens: ) '.
Thanks.
------------------------------
jerry ven
Original Message:
Sent: Tue February 06, 2024 09:50 AM
From: Carlos Romero
Subject: Regarding DSPPGMREF
> CALL mylib/mypgm ('driver', 'lib1' , '*ALL' , '0')
Character ',' not valid following string ''driver' '.
Character ' ' not valid following string ', '.
Character ' ' not valid following string ', '.
Error found on *N command.
Have you tried without commas (CALL mylib/mypgm ('driver' 'lib1' '*ALL' '0'))?
------------------------------
Carlos Romero