I need to write a CL program to obtain the IP addresses for all printers (LAN & RMTOUTQ) that we have on our system. The only OS command I can find is WRKOUTQD, but this does not allow output to *file and only one can be specified. I was wondering if there is an API I can call that does this.
There is a process that you can go through to create this information. I have an example CL available for you to use that will create an external file with all the information that you require. You will need to write an RPG program or query to retrieve the desired information. The following are the steps that you need to do in order to make the CL work properly:
1. Create a externally described physical file for use by the CL. Below are the field specifications that will be needed:
*************** Beginning of data ** 0001.00 A R SPOOLTR 0007.00 A FILL1 1A 0007.01 A TEXT1 43A 0007.02 A OPTION 87A ****************** End of data *****
2. Execute the following command:
DSPOBJD OBJ(QSYS/QGPL) OBJTYPE(*LIB) OUTPUT(*OUTFILE) OUTFILE(XXXX/DSPOBJ (replace the XXXX with the library that you want the information stored into.)
3. Create the following CL:
PGM DCLF FILE(XXXX/DSPOBJ) CLRPFM FILE(XXXX/SPOOLT) DSPOBJD OBJ(*ALL/*ALL) OBJTYPE(*OUTQ) + OUTPUT(*OUTFILE) OUTFILE(GLEN/DSPOBJ) START: RCVF RCDFMT(QLIDOBJD) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) WRKOUTQD OUTQ(&ODLBNM/&ODOBNM) OUTPUT(*PRINT) CPYSPLF FILE(QPDSPSQD) TOFILE(XXXX/HHHHHH) + SPLNBR(*LAST) MBROPT(*ADD) DLTSPLF FILE(QPDSPSQD) SPLNBR(*LAST) GOTO CMDLBL(START) END: ENDPGM
Replace the XXXX with the library name of where the object was created. Replace the HHHHHH with the name of the file that was created in step one.
4. Run the CL.
5. With the file created in step one, you can use an RPG program, iSeries query or even download the file and get all the necessary information that you need.
MORE INFORMATION ON THIS TOPIC
The Best Web Links: Tips, tutorials and more.
Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.
Read this Search400.com Featured Topic: Managing your iSeries.
Ask the Experts yourself: Our systems management gurus are waiting to answer your technical questions.
Dig Deeper on Performance
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.