1) You do a query to QSYS2.SYSPROCS catalog view to see all the procedure's names. Normal RPG/CL/COBOL/C programs do not appear in QSYS2.SYSPROCS catalog view.
2) You call a DB2i procedure from ANY SQL interface within (such as embedded SQL, RUNSQL command) or outside of IBM i (such as Run SQL Scripts tool, ODBC, JDBS, DRDA). A DB2i procedure exists as a *PGM object type with an attribute of CLE (ILC C program -this applies to purely SQL procedure as well) or RPGLE (ILE RPG).
3) CREATE PROCEDURE statement in SQL does an equivalent of program object ceation in native IBM i.
Chance favors only the prepared mind.
Satid S.
Original Message:
Sent: Mon February 12, 2024 02:00 PM
From: jerry ven
Subject: Regarding DSPPGMREF
Hi,
Thanks for all these answers.
I have couple of more questions with this respect to this utility as it uses stored procedure in this example and shows references of service programs as well..
1) Can we know all the stored procedure names as well using this DSPPGMREF utility (this GITHUB program ?) , if not then how to know their names, how to idenify them and distinguish them from a normal RPGLE ,SQLRPGLE,CLLE or any other IBM i object ?
2) how to call them ? ( here it was called using RUNSQLSTM or right click on 'RUN SQL SCripts' options ) what is their object type ? ( here for this PGM_REFS it was found to be 'CLE' so is this the only object type of stored procedures always ( i mean for all type of stored procdures with in IBM i ?)
3)
If a service program is being reffered by any program object then is it mandatry that it's being called from the main
program object or it's reference just exists (here in DSPPGMREF REFS Table) becuase it was just needed to compile that program object ?
Thanks
Original Message:
Sent: Fri February 09, 2024 09:31 PM
From: Satid Singkorapoom
Subject: Regarding DSPPGMREF
Dear Jerry
Run SQL Script tool is good for running all kinds of SQL in DB2i and getting information relevant to tuning SQL performance of individual statement. Do a Google search and search in Youtube on "ibm i run sql scripts" and you will find more useful information on this great tool.
I do not have sufficient experience to answer all your questions but I suspect you may get it by doing Metadata query (SELECT relevant columns) to DB2i Catalog Views in QSYS2 library such as shown in the picture below. If you have further question relating SQL in DB2i, I suggest you ask your future questions in SQL group of this community.

------------------------------
Chance favors only the prepared mind.
-- Louis Pasteur
------------------------------
Satid S.
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
Original Message:
Sent: Sat February 03, 2024 12:39 PM
From: jerry ven
Subject: Regarding DSPPGMREF
Hi,
When testing this :-IBM-i-RPG-Free-CLP-Code/PGM_REFS/Readme.MD at master · SJLennon/IBM-i-RPG-Free-CLP-Code · GitHub
CALL mylib/mypgm ('driver' 'lib1' '*ALL' 0)
******************************************************
Command Entry
R
Previous commands and messages:
> 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.
****************************************************************************
Additional Message Information
Message ID . . . . . . : CPD0020
Date sent . . . . . . : 02/03/24 Time sent . . . . . . : 11:12:01
Message . . . . : Character ',' not valid following string ''driver' '.
Cause . . . . . : A delimiter is missing between two values or a delimiter
that is not valid was found.
Recovery . . . : Change the character that is not valid or if a delimiter
is missing insert one. More information on delimiters can be found in the
Information Center.
what i am doing wrong to call to test this procedure , how to correct this error so that i could get the desired call stack in the table defined inside this procedure?
Thanks
------------------------------
jerry ven
------------------------------