I have an RPG program that does this for devices... you can adapt for your usage.
The premise is creating a spooled file using the appropriate command, then using SQL to load a table.
Mine does this:
1. Creates a spool file by running command: WRKCFGSTS CFGTYPE(*DEV) OUTPUT(*PRINT)
2. Creates a pre-defined table in QTEMP using CRTDUPOBJ (table is DEVLIST)
3. Loads that table from the spool file data using SQL
Exec Sql Insert into DEVLIST
SELECT :sessID,
ORDINAL_POSITION,
SUBSTR(SPOOLED_DATA,2,10),
SUBSTR(SPOOLED_DATA,23,4),
TRIM(SUBSTR(SPOOLED_DATA,32,20)),
SUBSTR(SPOOLED_DATA,72,10),
SUBSTR(SPOOLED_DATA,87,6),
SUBSTR(SPOOLED_DATA,57,10)
FROM TABLE(SYSTOOLS.SPOOLED_FILE_DATA(
JOB_NAME => :jobName,
SPOOLED_FILE_NAME => :splName,
SPOOLED_FILE_NUMBER => :splNbr))
WHERE SUBSTR(SPOOLED_DATA,23,4) = '*DEV'
ORDER BY ORDINAL_POSITION;
HTH,
Greg
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of a4g atl
Sent: Monday, March 13, 2023 9:58 AM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: [EXTERNAL] Sample program to output a list of all printer status on the system.
I need to create a program to monitor the status of printers.
I did not find a SQL option that would have made it easy. There are some
API's but I could not locate rough info to get me going.
Does anyone have an example of a program that monitors the status of
printers?
I do not want to use WRKWTR *PRINT as that creates way too many print files.
TIA
--
Darryl Freinkel
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
[CAUTION! This email originated outside of the organization. Please do not open attachments or click links from an unknown or suspicious origin.]
As an Amazon Associate we earn from qualifying purchases.