I would like to let my users override the printed output to a printer of their choice but I need to protect them from themselves. Is there a way that I can determine if the name they enter is a valid print device? I would like to be able to do this in an RPG program on an AS400 running V5R4.
Software/Hardware used:
AS400 V5R4
ASKED:
November 8, 2010 8:28 PM
UPDATED:
November 9, 2010 1:31 AM
One possible beginning direction would be:
With QTEMP/DEVD populated, you’d perhaps be interested only in the devices that satisfied this condition:
It’s not required to use SQL to limit the rows only to “printer” devices. A CL program could use RCVF to read each row to see if the device name matched what was requested and if that device attribute indicated that it was a form of printer device. Any HLL could do the processing.
Or you could simply run:
If you execute CHGDEVPRT with no parms other than DEVD(), the only things that happen are verification that such a device exists and that it’s actually a printer. If either condition is false, an *ESCAPE message is returned.
There are more definite solutions if you want to use system configuration APIs. I can’t tell how far you want to go with this. Keep in mind that elements such as a user’s authority to a device or to an *OUTQ might be involved. Also, a “printer” device might not actually exist — it might only be a “remote output queue”.
Tom