AS/400 Printer IP address

I have a feeling I am not going to like the answer but I am going to ask the question anyway...

We have a mixture of printers here, for the most part, the "IP" address shows up with I do a WRKOUTQD
Every so often the network people will give away the IP that we have already assigned to an AS/400 printer.

Is there any way I can get a full listing of all of the printer IP addresses?
LVL 3
ScottParkerAsked:
Who is Participating?
 
_b_hCommented:
Here is some code that I used some time ago. It searches a library for outqs. It needs some work but may do what you need.

PGM        PARM(&LIB)
DCL  &LIB       *CHAR      10   /* LIBRARY/*ALL/*ALLUSR/*LIBL       */
/* PARMS FOR RETRIEVE OUTPUT QUEUE ATTRIBUTES API */
DCL &OQRCVR     *CHAR    1096   /*RECEIVER VARIABLE                  */
DCL &OQRCVRLEN  *CHAR       4   /*LENGTH OF RECEIVER VARIABLE        */
DCL &OQRCVRFMT  *CHAR      10   /*FORMAT NAME                        */
DCL &QUALOQ     *CHAR      20   /*QUALIFIED OUTQ NAME                */
DCL &ERRCDE     *CHAR       8   /* API ERROR CODE PARAMETER          */
/**/
DCL &RMTSYSTYPE *CHAR       1   /* REMOTE SYSTEM TYPE                */
DCL &RMTSYSNAME *CHAR      20   /* REMOTE SYSTEM NAME                */
DCL &MSG        *CHAR      60   /* MESSAGE                           */
DCL &DEVDATR    *CHAR      10   /* DEVICE DESCRIPTION ATTRIBUTE      */
DCL &COUNTOQ    *DEC     (6 0)  /* TOTAL COUNT OF OUTPUT QUEUES      */
DCL &COUNTOQC   *CHAR       6   /* TOTAL COUNT OF OUTPUT QUEUES CHAR */
DCL &COUNTROQ   *DEC     (6 0)  /* TOTAL COUNT OF REMOTE OUTQS       */
DCL &COUNTROQC  *CHAR       6   /* TOTAL COUNT OF REMOTE OUTQS  CHAR */
DCL &COUNTROQD  *DEC     (6 0)  /* COUNT OF REMOTE OUTQS WITH DEVD   */
DCL &COUNTROQDC *CHAR       6   /* COUNT OF RMTOUTQS WITH DEVD CHAR  */
/**/
DCLF       FILE(QADSPOBJ)
/**/
             DSPOBJD    OBJ(&LIB/*ALL) OBJTYPE(*OUTQ) +
                          OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPOBJ)
             OVRDBF QADSPOBJ TOFILE(QTEMP/QADSPOBJ)
             CHGVAR  &OQRCVRLEN  X'00000448'    /* X'0448' IS 1096 OF DATA */
             CHGVAR  &OQRCVRFMT  'OUTQ0100'
             CHGVAR  &COUNTOQ    0
             CHGVAR  &COUNTROQ   0
NEXTOQ:
             RCVF
             MONMSG     MSGID(CPF0864) EXEC(DO)
             GOTO       CMDLBL(ENDOFFILE)
             ENDDO
             /*RETRIEVE THE ATTRIBUTES OF THE OUTPUT QUEUE */
             CHGVAR  &QUALOQ  (&ODOBNM  || &ODLBNM     )
             CALL QSPROUTQ (&OQRCVR &OQRCVRLEN &OQRCVRFMT &QUALOQ &ERRCDE)
             CHGVAR  &COUNTOQ   (&COUNTOQ + 1)
             CHGVAR &RMTSYSTYPE  %SST(&OQRCVR 217 1)
             /* CHECK IF OUTQ HAS A SYSTEM NAME (IP OR NAME) */
             IF (&RMTSYSTYPE *NE '0') THEN(DO)
                CHGVAR &RMTSYSNAME  %SST(&OQRCVR 218 20)
                CHGVAR &MSG ( &ODLBNM *CAT &ODOBNM *CAT &RMTSYSNAME)
                CHGVAR  &COUNTROQ   (&COUNTROQ + 1)
                /* CHECK IF A DEVICE EXISTS */
                CHGVAR  &DEVDATR   '          '
                RTVOBJD QSYS/&ODOBNM OBJTYPE(*DEVD) OBJATR(&DEVDATR)
                MONMSG (CPF9800) EXEC(DO)
                   CHGVAR  &DEVDATR   '          '
                   ENDDO
                IF (%SST(&DEVDATR 1 3) = 'PRT') THEN(DO)
                   CHGVAR  &COUNTROQD  (&COUNTROQD + 1)
                   ENDDO
                CHGVAR &MSG (&MSG *BCAT &DEVDATR)
                SNDPGMMSG &MSG
                ENDDO
             GOTO       CMDLBL(NEXTOQ)
ENDOFFILE:
             CHGVAR &COUNTOQC  &COUNTOQ
             SNDPGMMSG ('TOTAL OUTPUT QUEUES:       ' *CAT &COUNTOQC)
             CHGVAR &COUNTROQC  &COUNTROQ
             SNDPGMMSG ('TOTAL REMOTE OUTQS:        ' *CAT &COUNTROQC)
             CHGVAR &COUNTROQDC  &COUNTROQD
             SNDPGMMSG ('REMOTE OUTQS WITH DEVICES: ' *CAT &COUNTROQDC)
ENDPGM:
             ENDPGM

0
 
felnyCommented:
http://www.download25.com/install/free-ip-scanner.html

only need to get the star ip addres to final ip addres.

example 192.168.1.0 --> 192.168.1.254
0
 
tliottaCommented:
ScottParker:

> ...listing of all of the printer IP addresses?

"All" the printers? Since you describe changes of printer IP addresses, it's not clear if you mean "all of the printers that are supposed to be used by our AS/400" or "all of the printers on our network that might be used someday by our AS/400".

Can you clarify? There might be many printers with IP addresses in your network that your AS/400 shouldn't print on.

Normally, this should be handled by DNS and related protocols -- don't use IP addresses; use DNS to supply the address based on the name. If a host name identifies a printer, your network people shouldn't be changing its IP address nor giving out conflicting addresses. If devices aren't identified, then your AS/400 sure shouldn't be sending simply to an IP address.

Tom
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ScottParkerAuthor Commented:

tliotta,
To clarify... A way to get all of the IP addresses that are currently listed in any OUTQ definitions.

I did not innitialy set up how OUTQ's are assigned on our iSeries... I only have to deal with it now.
And I have NO control over our "Network" department.  That is why I want to give them a list of whats currently set up.

I do not claim to know a lot about OUTQ's and devices and such... But the way I was trained was just to do a CRTOUTQ command and fill in certian fields.   One of those fields is the "IP" address.

0
 
ScottParkerAuthor Commented:
That is great code, and kind of what I am looking for but not quite.
It does not show the IP addresses.
The only place I can seem to find them is in the "WRKOUTQD" command.  and that does not have an option to go to a file.  only to the display or print.
0
 
tliottaCommented:
ScottParker:

Okay, then here's a proc that accepts a qualified *outq name and displays whatever is returned in the 'Remote system name' attribute. It relies on (1) Barry's code to pass in the qualified name and (2) the Retrieve Output Queue Information (QSPROUTQ) API to resolve basic attributes.

For reference:

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/apis/QSPROUTQ.htm

If compiled as a program named RTVOUTQIP, it could be called from a command line as:

 == >  call RTVOUTQIP  'ARMTOUTQ  MYLIB     '


QCLSRC.RTVOUTQIP.txt
0
 
tliottaCommented:
BTW, that last code doesn't go to a 'file' either. But then, CL technically has no way to output to a 'file' except a display file.

You can print by binding printf() or other means; you could use STRQMQRY or other SQL functions to run INSERT or other statements; or you could store the data elements [outq, outq library, IP address, whatever] in a message queue or other object.

Or convert the code to COBOL or RPG or C or REXX or whatever languages you have available. Those have useful file I/O functions available.

I'll apologize and offer my only defense as not knowing what level of knowledge you posess. Your rating says 'Advanced'.

Tom
0
 
_b_hCommented:
okay, i'm out
0
 
ScottParkerAuthor Commented:
Ack..
I messed up on assigning the points.

Is there any way to redo that?
0
 
tliottaCommented:
ScottParker:

Agreed on points need re-doing. Barry clearly needs a major share. Unfortunately, I don't know the procedure. I see a [Request attention] link in the opening post, lower right, though I don't know what it does. I know that Dave Slater (a Zone advisor here) can provide all info needed.

Tom
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.