midrange.com code scratchpad
Name:
Select Product QSZSLTPR API
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
06/02/2017 03:46:40 pm
IP:
Logged
Description:
Retrieves a list of installed products
Code:
  1. **free
  2. // Select Product QSZSLTPR API
  3.  
  4. /copy qrpglesrc,stdhspec
  5.  
  6. /copy qsysinc/qrpglesrc,QSZSLTPR
  7. /copy qsysinc/qrpglesrc,QUSEC
  8.  
  9. dcl-pr sltPrd extpgm('QSZSLTPR');
  10.  prdList like(prdList);
  11.  inpInfo like(inpInfo) const;
  12.  format char(8) const;
  13.  inpList like(inpList) const;
  14.  outInfo like(outInfo);
  15.  errcde like(qusec);
  16. end-pr;
  17.  
  18. dcl-s prdList like(QSZS0200) dim(100);
  19.  
  20. dcl-ds inpInfo qualified;
  21.  nbrrcds int(10);
  22.  nbrprods char(10);
  23.  initial_view char(1);
  24.  allow_exit char(1);
  25.  prdoptions char(10);
  26.  prod char(10);
  27.  rcdsinlist int(10);
  28. end-ds;
  29.  
  30. dcl-s inpList char(18) inz(*blanks);
  31.  
  32. dcl-ds outInfo qualified;
  33.  recsize int(10);
  34.  recsavail int(10);
  35.  action int(10);
  36. end-ds;
  37.  
  38. dcl-s i int(10);
  39. dcl-s msg varchar(50);
  40.  
  41. inpInfo.allow_exit = '1';
  42. inpInfo.initial_view = '1';
  43. inpInfo.nbrprods = '*ALL';
  44. inpInfo.nbrrcds = %elem(prdList);
  45. inpInfo.prod = '*INSTLD';
  46. inpInfo.prdoptions = '*ALL';
  47. inpInfo.rcdsinlist = 0;
  48.  
  49. QUSBPRV = 0;
  50. QUSBAVL = 0;
  51.  
  52. // get the list
  53. sltPrd(prdList(1): inpInfo: 'PRDS0200': inpList: outInfo: QUSEC);
  54.  
  55. // do something with it
  56. for i = 1 to outInfo.recsavail;
  57.   QSZS0200 = prdList(i);
  58.   msg = QSZPI03 + ' ' + QSZPO05 + ' ' + QSZRL06 + ' ' +
  59.     %subst(QSZDT00: 1: 20);
  60.   dsply msg;
  61. endfor;
  62.  
  63. *inlr = *on;
© 2004-2019 by midrange.com generated in 0.005s valid xhtml & css