Retrieve iSeries network printers list

The place for general PHP questions and hints for PHP on IBM i

Retrieve iSeries network printers list

Postby ahaithcox on Tue Apr 03, 2012 2:33 pm

Has anyone had any luck at retrieving a list of all attached and/or network printers on the iSeries? I can get a list of all *OUTQ objects but it really doesn't narrow it down enough to actual physical printers only:

Code: Select all
...

if (isset($conn)) {
    // Open the list
    $list = i5_objects_list('*ALL', '*ALL', '*OUTQ');

    if ($list !== false) {

        // Retrieve each list item putting it into an array
        while ($row = i5_objects_list_read($list)) {
            $listArr[] = trim($row['NAME']);
        }

        // Close the resource
        i5_objects_list_close($list);

        // Sort array
        sort($listArr);
       
        // Remove duplicates
        $listArr = array_unique($listArr);

        echo $listArr;

    }
}

...
ahaithcox
 
Posts: 43
Joined: Mon Oct 03, 2011 5:22 pm

Re: Retrieve iSeries network printers list

Postby bdietz on Mon Apr 23, 2012 7:07 pm

one option would be to use a utility I wrote:
http://home.roadrunner.com/~jbmmdietz/wrkrmtwtr.html

which has an option to output to a file, then you could read that file and format as you wish.

If that does not work for you what you need to do is to call the API QSPROUTQ with format OUTQ0100 against each outq in the list you generate.

The output of that API can be checked to see if the outq is really a remote writer.
I have an example CLP included in my utility so you can see how to determine which are remote writers.

Bryan
bdietz
 
Posts: 10
Joined: Sun Jun 28, 2009 4:22 pm

Re: Retrieve iSeries network printers list

Postby ahaithcox on Mon Apr 23, 2012 8:47 pm

Perfect. Thanks. I'll give it a look.
ahaithcox
 
Posts: 43
Joined: Mon Oct 03, 2011 5:22 pm


Return to PHP Questions / Hints

Who is online

Users browsing this forum: No registered users and 1 guest