zOs/WK/PKGUSLST
$#@
$=subsys=DBTF
$=rz=-sysvar(sysnode)
$=dsn=A540769.wk.texw(pkgusLst)
$;
$<=[
A RZ1 DBAF
T RZ1 DBTF
P RZ2 DBOF
Q RR2 DBOF
C RZ8 DC0G
D RZ8 DD0G
E RZZ DE0G
$] $@for sLi $@[
parse value $sLi with mrk rz sub .
if $rz == rz & $subsys == sub then
$=mark =- mrk
$]
$;
if \ ${?mark} then
call err 'mark not found for' $rz'.'$subsys
say $rz'.'$subsys'==>'$mark'|'
if sysdsn("'"$dsn"'") == 'OK' then
call readDsn $dsn, 'M.INP.'
else
m.inp.0 = 0
say m.inp.0 'recs in' $dsn
call sqlConnect $subsys /* achtung ebcdic sortieren wegen REXX| */
call sqlPreOpen 1, "select collid, name, version, pctimestamp" ,
", hex(contoken), timestamp" ,
"from sysibm.sysPackage",
"where collid like 'AV%'",
"order by cast(collid as varchar(128) ccsid ebcdic)",
", cast(name as varchar(128) ccsid ebcdic)",
", cast(version as varchar(128) ccsid ebcdic)",
"with ur"
ix = 1
px = 0
m.out.1 = '*' $mark '==>' $rz'.'$subsys date('o') time()
m.out.0 = 1
do while sqlFetchInto(1, ":col, :pkg, :vers, :pctst, :conT, :creT")
px = px+1
cpv = strip(col)'.'strip(pkg)'('strip(vers)')'
if px // 5000 = 0 then
say 'pkg' px 'out' m.out.0 'ix' ix':'cpv
do while ix <= m.inp.0 & (abbrev(word(m.inp.ix, 1), '*') ,
| word(m.inp.ix, 2) << cpv)
call mAdd out, m.inp.ix
ix = ix + 1
end
mrCu = $mark
if word(m.inp.ix, 2) >> cpv | ix > m.inp.0 then do
call mAdd out, left($mark, 10)cpv 'cre:' mrCu'='creT ,
'con:' mrCu'='conT 'pct:' mrCu'='pcTst
end
else if word(m.inp.ix, 2) == cpv then do
parse var m.inp.ix mark iCpv 'cre:' iCre 'con:' iCon 'pct:' iPc
mark = word(m.inp.ix, 1)
do cx=1 to length(mark) while mrCu >> substr(mark, cx, 1)
end
if mrCu \== substr(mark, cx, 1) then
mark = left(mark, cx-1)mrCu || substr(mark, cx)
if pcTst << word(m.inp.ix, 3) then
pcTst = word(m.inp.ix, 3)
call mAdd out, left(mark, 10)cpv ,
'cre:' strip(iCre) mrCu'='creT ,
'con:' strip(iCon) mrCu'='conT 'pct:' strip(iPc) mrCu'='pcTst
ix = ix + 1
end
else
call err 'bad merge seq cpv' cpv 'inp.'ix m.inp.ix
end
call sqlDisconnect
say 'pkg' px 'out' m.out.0 'ix' ix':'cpv
call writeDsn $dsn, 'M.OUT.', , 1
$#out 20120123 20:55:11