print q jobs

Hi,
I need to get queue name ,status and numbero jobs waiting in queue.I was using lpstat and i got the queue name ,status and number of jobs waiting but the problem with lpstat is that when printer is out of paper then it shows printer status ready and 0 jobs in queue.is there any way that i can find queue name,status and total number of jobs waiting in queue when printer is out of paper or queue is down etc.
i need first,second column and sum of 9th column.
please give me guide line to fix this. thanks
Queue Dev Status Job Files User PP % Blks Cp Rnk
-------------------- -------------- --------- ------ ------------------ ---------- ---- --- ----- --- ---
abxxxp09 abxxxp09 READY

Does your system have lpq - will show something like 'printer not ready' or somesuch when the printer has issues. It will not say 'out of paper'

no printer status is ready when it is out of paper.so jobs are there but i cant see those with lpq or lpstat.is there any other way to see those jobs.thanks

enq -sAW | grep DOWN " to check the down queues"

Nabeel

thanks for reply. actually i need to consider READY state too not only DOWN or QUEUE. in case printer is in ready state but number of jobs are higher than threshold then i have send a mail thats why i am looking to find out number of jobs in a queue