Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to check a device and a printer

1,457 views
Skip to first unread message

Patrick Tonnerre

unread,
Jul 29, 2011, 7:54:23 AM7/29/11
to
Good Morning,

i have 3 or more printers in each branch of my company and each night i
send automatic reports to printer 01.
Some branches swith off printer 01 when they leave each day.

In order to send these reports to printer 02 (or 03, 04...) if 01 if
offline, I am now looking for an operating mode or a CLP to check if a
printer is alive (check the device status and its editor).

Thank You
--
Pat

Ken Sims

unread,
Jul 29, 2011, 10:56:04 AM7/29/11
to
Hi Pat -

I don't have the time to look up the name of it right now, but there
is an API that you can use to check if there is a writer running and
what its status is. I.e. if there is a writer, but it is in MSGW
status, you might still want to send the report to a different
printer.

--
Ken
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.

JTF

unread,
Jul 29, 2011, 1:21:03 PM7/29/11
to
I created a program a while back to ping a host name or IP and tell me if it pinged or not and even the turnaround time....

http://pastebin.com/cDs3f3Tm

Create a program with a list of IP addresses and maybe branch number/name and you can programatically choose which printer based on ping confirmation.

iseriesflorida

unread,
Jul 29, 2011, 3:05:46 PM7/29/11
to

Are you using device/outq's or just remote outq's. Look at using
rtvcfgsts and the stscde parm.

Ken Sims

unread,
Jul 29, 2011, 11:28:46 PM7/29/11
to
Hi Pat -

On Fri, 29 Jul 2011 13:54:23 +0200, Patrick Tonnerre
<nos...@nospam.org> wrote:

>In order to send these reports to printer 02 (or 03, 04...) if 01 if
>offline, I am now looking for an operating mode or a CLP to check if a
>printer is alive (check the device status and its editor).

Follow up to my prior post:

The API for checking the status of a writer is the QSPRWTRI (Retrieve
Writer Information) API.
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/apis/QSPRWTRI.htm

You can give it the printer name and get back information about the
associated writer. You'll need to check the API error status (for
example, if there is no writer running) and if there are no errors,
check the various writer and output queue status flags to determine if
you want to use a particular printer.

Though typically a printer prints from an output queue of the same
name in QUSRSYS, that doesn't have to be true. You can get the actual
output queue name and library name from the information returned by
the API.

You shouldn't need to check the device status with this method,
however if you want to, you can.

If you are writing a CL program, you can use the RTVCFGSTS status.

If you are using some other HLL, you can use the QDCRCFGS (Retrieve
Configuration Status) API which provides the same information.
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/apis/QDCRCFGS.htm

JTF

unread,
Jul 30, 2011, 8:29:48 PM7/30/11
to
I responded on Friday, it looks like the post didn't post.......


I wrote a program for several purposes a while ago.

PINGMONCL - Source posted here
http://pastebin.com/cDs3f3Tm

CALL PGM(PINGMONCL) PARM(&IPORNAME &YESNO &rspnstim)

You can utilize this program to ping by IP or hostname and get back a 'Y' or 'N' as well as the response time in milliseconds...for your case, you would only be interested in &YESNO coming back from PINGMONCL.

Create a program to search a file containing the branch and printer ip or name (if applicable) and if your response is a 'Y', send to that printer....

Patrick Tonnerre

unread,
Aug 3, 2011, 9:47:05 AM8/3/11
to
Le 29/07/2011 21:05, iseriesflorida a �crit :

Good Morning,

i've already started a CLP program using that command :

WRKCFGSTS CFGTYPE(*DEV) CFGD(&PRINTERS) OUTPUT(*PRINT) +
STATUS(*ACTIVE)

Then i will copy it in a file which will be processed.
That command seems to be interesting for me because if a printer is not
started il will not appear in the list.

Completed with a ping i hope it will be useful for me.

I've never use APIs on iSeries CLP.
Maybe somebody have some examples or URL's describing their usage.

Thank You all for your help
--
Pat

JTF

unread,
Aug 10, 2011, 1:20:32 PM8/10/11
to
That will start the printer if it is stopped, but if the printer is off or communications to the remote site is down for what ever reason, it won't help.

Pinging the printer will confirm that you have communications (and that the printer is on)

0 new messages