> Behalf Of VANCE,JEFF (HP-Cupertino,ex1)
>
> ooops, correction in my abbreviated WHILE loop below:
>
> ...
> > setvar if_printer false
> > while not if_printer and &
> > setvar(_sp_eof,_sp_eof-1) >= 0 &
> > "!ldevno" <> word(setvar(_sp_rec,dwns(input()))) do
> endwhile
> # We have an LDEV match or we hit eof
> if _sp_eof >= 0 and &
> pos('spooled',_sp_rec) > 0 and pos('down',_sp_rec) = 0 then
> > echo Printer found number: !ldevno
> > setvar if_printer true
> > endif
>
> I moved the endwhile up and thus the WHILE loop has no body.
> You don't need to read anymore SHOWDEV records once you find
> the matching LDEV number, even if the LDEV is DOWN or is
> not SPOOLed.
>
I've followed this thread with some interest. Before I continue, however,
let me point out that this script does not work if the spooler is stopped.
Consider this example from my test system where ldev 100 is a DTC printer
and ldev 2001 is a network printer:
[17]:showdev 100
LDEV AVAIL OWNERSHIP VOLID DEN ASSOCIATION
100 SPOOLED SPOOLER OUT
[18]:showdev 2001
LDEV AVAIL OWNERSHIP VOLID DEN ASSOCIATION
2001 SPOOLED SPOOLER OUT
[19]:stopspool 100
[20]:stopspool 2001
[21]:showdev 100
LDEV AVAIL OWNERSHIP VOLID DEN ASSOCIATION
100 AVAIL
[22]:showdev 2001
LDEV AVAIL OWNERSHIP VOLID DEN ASSOCIATION
2001 AVAIL
Both 100 and 2001 will fail to be identified as printers with this script
and probably any other reasonable script you can come up with. However,
there are probably at least 100 people on this list who could write a simple
routine using AIFs to make this determination. In fact, those same people
could write a devinfo procedure that mimics pinfo and finfo if there were
some way to hook it into the CI, making the original question trivial to
answer.
This was an SIB item that received some interest, though the power of the
enhancement (making the CI extensible) was probably never adequately
explained.
John
***********************************************************
* John Burke *
* Burke Consulting Email: [log in to unmask] *
* 7224 Pine Grove Way Phone: (916) 987-0265 *
* Folsom, CA 95630 Web: www.burke-consulting.com *
***********************************************************
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|