Operating System - OpenVMS
1752822 Members
4187 Online
108789 Solutions
New Discussion юеВ

Re: LPQ command in DCL procedure has no timeout (Find a way to limit a command duration time)

 
SOLVED
Go to solution
Kortlandt
Advisor

LPQ command in DCL procedure has no timeout (Find a way to limit a command duration time)

Hiya,

I'm trying to generate an overview, with a DCL script, of all LPD printers, and check if they are available.

In the DCL procedure, I do

$ LPQ

But if there is no response, it'l hang endlessly. I can NOT mess with global timeout logicals.

I tried

$ PIPE LPQ | READ/TIMEOUT= SYS$PIPE a_line

But it does not work.

OpenVMS 7.2-2
TCPIP 5,1 ECO 4

Who can help me out?

Thnx,
Bob.
5 REPLIES 5
RBrown_1
Trusted Contributor

Re: LPQ command in DCL procedure has no timeout (Find a way to limit a command duration time)

Do these commands work interactively?
Hoff
Honored Contributor

Re: LPQ command in DCL procedure has no timeout (Find a way to limit a command duration time)

Upgrade? This is ancient stuff.

If you won't upgrade (which is what I suspect when presented with these cases), then you can brute-force a DCL timeout using a SPAWN that first issues a second nowait spawn of a subprocess that itself first finds and then waits and then kills its parent (and itself in the process), then issue the LPQ.

Alternatively, ping might provide a basic idea if the printer is reachable. (LPD/LPR is rather simple-minded, as printing software goes.) Or SNMP, if the printer supports it.

But getting (more) current software loaded would be better in general. Both OpenVMS Alpha and TCP/IP Services, and ECOs for same.
John Gillings
Honored Contributor
Solution

Re: LPQ command in DCL procedure has no timeout (Find a way to limit a command duration time)

Bob,
Try the attached command procedure

$ @CMD_TIMEOUT command...

For example:

$ @CMD_TIMEOUT 0:0:30.0 LPQ MYQUEUE

will give the command 30 seconds to complete. Status is that of the command or %SYSTEM-F-EXITFORCED if the command was timed out.
A crucible of informative mistakes
Phil.Howell
Honored Contributor

Re: LPQ command in DCL procedure has no timeout (Find a way to limit a command duration time)

If you have a look at the system startup procedures, some products (decwindows?) use a method of spawning subprocesses with /nowait and then waiting for completion.

or just use John's procedure
Kortlandt
Advisor

Re: LPQ command in DCL procedure has no timeout (Find a way to limit a command duration time)

Hello all,

@John:
This works fine for me, Thnx!


@Hoff:
- I am not able to upgrade, unfortunately.
- The spawn procedure you suggest is the CMD_TIMEOUT procedure of John.
- Pinging (Which I would prefer as well) is not an option, printer is just known as remote port on a remote machine in a different company then which I am in.

Thnx to you all for your response,

Grtz,
Bob