Created
September 28, 2019 14:47
-
-
Save forstie/51592c752310843a96eecc2475d68dab to your computer and use it in GitHub Desktop.
The Display Software Resources (DSPSFWRSC) command allows you to show, print, or write to an output file the list of installed software resources. This SQL example shows how to externalize the same detail by extracting message text and transforming numerics into integer form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- category: Software Resources | |
-- description: DSPSFWRSC for SQL users | |
-- | |
create or replace function coolstuff.whatsinstalled () | |
returns table ( | |
product varchar(7) ccsid 37, load integer, option integer, | |
software_text varchar(132) ccsid 37 | |
) | |
external action | |
modifies sql data | |
begin | |
call qsys2.qcmdexc( | |
'QSYS/DSPSFWRSC OUTPUT(*OUTFILE) OUTFILE(QTEMP/PROD_INFO) OUTMBR(*FIRST *REPLACE)' | |
); | |
return select lcprdi, lcpfgi, lcsfgi, message_text | |
from qtemp.prod_info | |
inner join qsys2.message_file_data | |
on message_file_library = lcdtml | |
and message_file = lcdtmf | |
and message_id = lcdtmi; | |
end; | |
-- Display Software Resources... | |
select * from table(coolstuff.whatsInstalled()); | |
-- Is DB2 SMP installed? | |
select count(*) SMP_INSTALLED from table(coolstuff.whatsInstalled()) | |
where product = '5770SS1' and option = 26; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment