On 04-Feb-2016 12:16 -0700, Hoteltravelfundotcom wrote:
Is it possible to print the old Query/400. We would love to have our
consultant convert them to an SQL. Some of them are rather complex
for what they are. Obviously I can make screen shots of all the
pages, but that is a bit time consuming.
  There is a pseudo-API for the Print Query Definition (the nonexistent 
PRTQRY to mimic the 6=Print of the IBM i Query [aka Query/400]) feature. 
 I allude to that feature here:
[
http://archive.midrange.com/midrange-l/201007/msg00837.html]
  Because the feature was written by someone not familiar with the 
product, and without anyone informing me first, I could not help to 
/make it right/ originally; but I was tasked with issuing an urgent fix 
to correct a corruption problem that the new feature had, per calling 
the run-time program without first generating the run-time Query 
Definition (QRYDFN).
  As I recall, the output is produced from "a" printer file QPQUPRFIL, 
but possibly not "an" appropriate PRTF by that name.
  The interface, IIRC, is via an SQL stored procedure.  Searching the 
SYSROUTINES catalog on a system I found PCMM_QRYI in QSYS2, but I have 
my doubts that is what I was looking for.  Time passes... as I try 
searching the web and searching routines for '%PR%' since originally 
searching '%QRY%' ...  Ah, found it: PRINT_QUERY_DEFINITION in QSYS2.
  From an article by Gene Cobb:
Sinking in a Query/400 Quagmire?
Use Print_Query_Definition to assist in your database modernization
efforts
As published June 2011 by IBM Systems Magazine
Written by Gene Cobb – cobbg@xxxxxxxxxx
"...
This stored procedure has 3 parameters:
  • Query_library - The name of the library that contains the query
   <ed: varchar(10)>
  • Query_name - The name of the query
   <ed: varchar(10)>
  • Language_option
   <ed: integer>
    o 0 – The printed results are translated based on the first MRI 
library in the library list.
    o 1 – The results are printed in English
Considerations:
  • Print_Query_Definition is a stored procedure and as such must be 
called from SQL interfaces such as STRSQL, Run SQL Scripts window in 
System i Navigator, or embedded SQL in RPG program.
• The names must be specified in the correct case. The names must be 
passed in upper case unless the names are delimited.
Here is an example invocation of the stored procedure that prints the 
definition for the query object named REVGPFTQRY in library QWQCENT:
  CALL QSYS2/Print_Query_Definition('QWQCENT','REVGPFTQRY', 1)
   -- <ed: corrected syntax to allow comma as decimal point>
 ..."
As an Amazon Associate we earn from qualifying purchases.