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
JOB_NAME => :jobName,
SPOOLED_FILE_NAME => :splName,
SPOOLED_FILE_NUMBER => :splNbr))
WHERE SUBSTR(SPOOLED_DATA,23,4) = '*DEV'
ORDER BY ORDINAL_POSITION;
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of a4g atl
Sent: Monday, March 13, 2023 9:58 AM
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
I do not want to use WRKWTR *PRINT as that creates way too many print files.
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,
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
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.