50 pts.
 Access AS400 Query Print Definitions
I need to generate a report that shows the output type and the name of the output device found in the print definitions of a designated query. Since there are a lot of queries to check, I need to get access to the query print definitions without using WRKQRY option 6. I would be happy if there is an existing AS400 command or procedure that does exactly what WRKQRY option 6 does, so that I can check all queries in a designated library.

Software/Hardware used:
AS400 I-Series
ASKED: April 19, 2011  4:53 PM
UPDATED: May 2, 2011  11:05 PM

Answer Wiki:
Convert it to sql and store in file. Then search it.. or view the source file. I use this to find fields or specific data inside the queries.. I hate looking at all of them to find what I'm looking for QSYS/CRTSRCPF FILE(QTEMP/QDDSSRCT) MONMSG MSGID(CPF0000) QSYS/RMVM FILE(QTEMP/QDDSSRCT) MBR(*ALL) MONMSG MSGID(CPF0000) DSPOBJD OBJ(KEN/*ALL) OBJTYPE(*QRYDFN) + OUTPUT(*OUTFILE) OUTFILE(QTEMP/QUERYOUT) QSYS/RTVQMQRY QMQRY(&IN_ODLBNM/&IN_ODOBNM) + SRCFILE(QTEMP/QDDSSRCT) ALWQRYDFN(*YES) QSYS/FNDSTRPDM STRING('search string') FILE(QTEMP/QDDSSRCT) + MBR(*ALL) OPTION(*NONE) PRTMBRLIST(*YES)
Last Wiki Answer Submitted:  April 25, 2011  3:29 pm  by  RonKoontz   1,780 pts.
All Answer Wiki Contributors:  RonKoontz   1,780 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I would be happy if there is an existing AS400 command or procedure that does exactly what WRKQRY option 6 does…

The only such command is WRKQRY with its option 6. That’s it. No more.

Technically, you could create an emulator macro that did WRKQRY option 6 for every query in a library. If you did that for a fresh emulator session, at least all of the spooled files would be in a single job.

Tom

 107,915 pts.

 

Have you tried to use cmd DMPOBJ and study the print ?
I have hard times to understand why you need this info, – pls tell us.
If your task is to control which printers are to be used, you may create a cl-pgm with OVRPRTF and RUNQRY with parameters in it.

.. still puzzles me what you want to obtain…

DanF

 2,540 pts.

 

Tom,

Thanks for your response. I will look into the emulator macro that you suggested. In the meantime, the operator is performing the WRKQRY option 6 to create the spool file that has the print definitions. These spool files are sent to a designated outq, and my CL procedure takes over from there, by extracting the needed info from the spool files. For the operator’s sake, I was hoping to make this all a one-step process.

Thanks again.

Ray

 50 pts.

 

I have a program that I created a few years back that gets the info out of a query like input files, output files, summary/detail and printer. I can send it to you if you like. It’s only 350 lines long but does a great job at collecting that info.

 80 pts.

 

The DMPOBJ option can work. It might take some experimentation with a query to see what changes when a printer reference is changed.

ISeriesGuyWI might have a solution for you. I’m aware of two different methods for retrieving the info, depending on what version/release your OS is at (and what security is set for your system.) Programming generally either uses MI functions to resolve elements of the *QRYDFN object or dumps the object and harvests the spooled output.

I might code a basic CL to run WRKQRY over a list of the objects. Then I’d have a macro that responded as each one was displayed to navigate to the printer reference. Once there, you might have the macro move to the printer name, copy the name and execute SNDMSG to a message queue. Just a little creative macro work could give you everything in a single location. There’s actually a lot of useful intelligence that can be put in (with some practice).

Tom

 107,915 pts.

 

ISeriesGuyWI,

Yes, I would really like to see that program… it sounds like just what I am looking for.

Thank you so much!

Ray

 50 pts.

 

Ray, send me an email to jforss@wincraft.com and I will send it to you. If you are going to COMMON in Minneapolis I can give it to you there.

 80 pts.