Mark.Donaldson AT cexp DOT com wrote, in part:
> "bpdbjobs -all_columns" will do it - it's the DB that populates the GUI's
> details pane. Parsing the output is less than fun but Storage Mountain used
> to have an Auto-FAQ on it that was pretty good (sorry - no link, too little
> coffee, yet).
The bpdbjobs output is comma delimited. About 32 fields down an output
line is the count of fields (each a logical line) that follows ... that
is the file list. Skip 9 more fields and you get to the count of fields
(each a logical line) that follows ... that is the output.
cheers, wayne
P.S. Here's a quick and dirty Rexx program I use (mostly to look at the
current Vault Duplication job, but it works with any job v4.5 and 5.0,
at least on my Solaris system): (watch out for wrapping in this mail!)
#!/usr/local/bin/rexx
/* seelastmsg.rex -- Display task detail msg(s) for a jobid,
defaulting to active duplication jobs
2003-11-25 wts@
*/
trace off
signal on NOVALUE
signal on SYNTAX
parse upper arg jobid rest
"rm /tmp/seelastmsg.txt 2> /dev/null"
if jobid=='' then filter = 'grep Duplication'
else filter = "gawk '{if ($1=="jobid") {print $0}}'"
address SYSTEM ,
'bpdbjobs -report|' filter,
with output stem dup.
if rc<>0 then do
if jobid=='' then say 'Error' rc ,
'when trying to find Duplicate jobs in the jobs database.'
else say 'Error' rc ,
'searching for jobid' jobid 'in the jobs database.'
do i=1 to dup.0
say dup.i
end
end
else do
if dup.0==0 then ,
if jobid=='' then say 'There is probably no active duplication now.'
else say 'There is probably no job' jobid ,
' in the jobs database.'
end
do idup=1 to dup.0
dupinfo = dup.idup
if jobid==word(dupinfo,1) then call displayjob
else if word(dupinfo,3)=="Active" then call displayjob
end
exit
displayjob:
jobnum = word(dupinfo,1)
address SYSTEM,
"bpdbjobs -all_columns|gawk -F , '{if ($1=="jobnum") {print $0}}'",
with output stem detail.
if rc==0&detail.0>0 then do
dupdetail = detail.1
do i=1 to 31
parse var dupdetail t ',' dupdetail
end
parse var dupdetail t1lines ',' dupdetail
if datatype(t1lines,'W')==0 then ,
say 'Error! number of entries for tab 1 is "'t1lines'".'
else do
"echo '(Tab 1 has" t1lines "line(s):)' >> /tmp/seelastmsg.txt"
out1.0 = t1lines
do i=1 to t1lines
parse var dupdetail out1.i ',' dupdetail
end
if t1lines>0 then ,
address SYSTEM "awk '{print $0}' >> /tmp/seelastmsg.txt" ,
with input stem out1.
end
do i=1 to 9
parse var dupdetail t ',' dupdetail
end
parse var dupdetail t2lines ',' dupdetail
if datatype(t2lines,'W')==0 then ,
say 'Error! number of entries for tab 2 is "'t2lines'".'
else do
"echo '(end of" t1lines ,
"line Tab 1 report)' >> /tmp/seelastmsg.txt"
"echo ' ' >> /tmp/seelastmsg.txt"
"echo '(Tab 2 has" t2lines "line(s):)' >> /tmp/seelastmsg.txt"
out2.0 = t2lines
do i=1 to t2lines
parse var dupdetail out2.i ',' dupdetail
end
address SYSTEM,
"awk '{print $0}' >> /tmp/seelastmsg.txt" with input stem out2.
"echo '(end of" t2lines ,
"line Tab 2 report)' >> /tmp/seelastmsg.txt"
if (out1.0+out2.0+4)>15 then 'less +G /tmp/seelastmsg.txt'
else 'cat /tmp/seelastmsg.txt'
end
end
return
/* ------------------------------------------------------ */
SYNTAX:
ERROR:
NOVALUE:
?erc = rc
signal off ERROR
signal off SYNTAX
signal off NOVALUE
parse source ?system ?invocation ?fn
if Sourceline()==0 then ?Sourceline = 'Sourceline not available'
else ?Sourceline = Sourceline(sigl)
?condition_type = condition('C')
?condition_desc = condition('D')
?msg1 = ?condition_type "error in line" sigl "of rexx program '"?fn"'."
?msg2 = " "?condition_desc
?msg3 = " Source:" ?Sourceline
?msg4 = " Most recent return code is" ?erc
say ?msg1
say ?msg2
say ?msg3
say ?msg4
exit 99
/* ------------------------------------------------------ */
|