All I wanted was a quick way to check which Binding Directories contain a certain service program. Included in IBM i 7.5 and 7.4 TR6 is a SQL View that can provide me with the information I desire.
If I wanted to see which Service Programs and Modules are contained within a Binding Directory I would use the Work With Binding Directory Entries command, WRKBNDDIRE:
WRKBNDDIRE BNDDIR(MYLIB/TEST) |
Which shows the following:
Work with Binding Directory Entries Binding Directory: TEST Library: MYLIB Type options, press Enter. 1=Add 4=Remove Opt Object Type Library Activation Date Time MODULE1 *MODULE *LIBL 06/08/21 18:15:28 SRVPGM1 *SRVPGM *LIBL *IMMED 06/08/21 18:34:10 SRVPGM2 *SRVPGM *LIBL *DEFER 06/08/21 18:41:08 |
The Binding Directory Information View, BINDING_DIRECTORY_INFORMATION, is found in the library QSYS2. It contains the same columns the screen does. If I run the following SQL statement to return the information for the same Binding Directory:
SELECT ENTRY_LIBRARY,ENTRY,ENTRY_TYPE, ENTRY_ACTIVATION,ENTRY_CREATE_TIMESTAMP FROM QSYS2.BINDING_DIRECTORY_INFO WHERE BINDING_DIRECTORY_LIBRARY = 'MYLIB' AND BINDING_DIRECTORY = 'TEST' |
The results look the same as the output from WRKDIRE.
ENTRY_ ENTRY ENTRY_ ENTRY_CREATE_ LIBRARY ENTRY _TYPE ACTIVATION TIMESTAMP ------- ------- ------- ---------- ------------------- *LIBL MODULE1 *MODULE <NULL> 2021-06-08 18:15:28 *LIBL SRVPGM1 *SRVPGM *IMMED 2021-06-08 18:34:10 *LIBL SRVPGM2 *SRVPGM *DEFER 2021-06-08 18:41:08 |
Let me go back to my original need: a quick way to find all of the Binding Directories a particular service program is in. Using BINDING_DIRECTORY_LIBRARY my SQL statement would be as simple as:
01 SELECT BINDING_DIRECTORY_LIBRARY AS "Bnd lib", 02 BINDING_DIRECTORY AS "Bnd dir", 03 ENTRY_LIBRARY AS "Entry lib", 04 ENTRY_ACTIVATION AS "Activation" 05 FROM QSYS2.BINDING_DIRECTORY_INFO 06 WHERE ENTRY = 'SRVPGM1' 07 AND ENTRY_TYPE = '*SRVPGM' |
Lines 6 and 7: The Where clause shows I am looking for only entries that are Service Programs and are called SRVPGM1.
The results are:
Bnd lib Bnd dir Entry lib Activation --------- ------- --------- ---------- MYLIB TEST *LIBL *DEFER MYTEST TEST *LIBL *DEFER PRODLIB PROD *LIBL *DEFER PRODLIB2 PROD *LIBL <NULL> |
I will be using BINDING_DIRECTORY_INFO frequently as it provides the answer to what I wanted to know very easily.
You can learn more about the BINDING_DIRECTORY_INFO SQL View from the IBM website here.
This article was written for IBM i 7.5 and 7.4 TR6.
useful, thanks for the hint.
ReplyDeleteThis is helpful Simon, Thanks you for sharing 👍
ReplyDelete