Midrange News for the IBM i Community


Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
Chicagoland
SQL iQuery Documentation - UDF and UDTF
has no ratings.
Published: 19 Jun 2019
Revised: 20 Aug 2019 - 1709 days ago
Last viewed on: 22 Apr 2024 (794 views) 
  1. SQL iQuery - RUNiQRY CL Command
  2. CSV() - Read and Parse Comma Separated Values File
  3. CSV_VAL() Extract CSV Column Value
  4. CSV_XXXX() Extract CSV Column Value as xxxx
  5. CSV_COUNT - Retrieve Field Count
  6. ObjExist - Check Object Exits
  7. DTAARA - Data Area
  8. encode_URL Encode URL for the Web
  9. encode_TAG Encode HTML TAG Content
  10. FLDLIST - List the Fields of a Table
  11. FROMHEX - Fold 2-hex Chars into 1 Char
  12. GET CPUCNT, CURLIB, ENV, SRLNBR, SYSNAME
  13. MD5_HASH - UDF - Return MD5 Hash
  14. ifsStat - Get IFS File Attributes
  15. ifsExists - Check if IFS File Exists
  16. ifsFile - Query Contents of IFS Text File
  17. ifsDIR - List IFS Directory Entires
  18. DEPFILE - List Dependent Database Relations
  19. JOB - Get Job Name Component
  20. Job_ATTR - Job Attributes
  21. JOB_DATE Retrieve the Job Date
  22. JOBLOG - Write Message to Joblog
  23. Library List UDF and Procedures
  24. MBRLIST - Member List
  25. MCHINFO Machine Type and Model Number and OS version
  26. OSVER and OSVRM Get IBM i Version/Release
  27. PrintPDF - Print a PDF to a PDF Compatible Printer
  28. CPYTOPDF - Copy SPOOLED File to PDF file
  29. OBJ_LIST List Object in a Library
  30. LIB_LIST List Descriptions of Libraries on the Library List
  31. OBJ_EXPORTS List Exported Items from an Object
  32. OBJ_STRUCT Retrieve Objects Components
  33. RTVCMDD Retrieve Command Definition
  34. RTVJOBA - Retrieve Job Attributes
  35. RTVJOBD - Retrieve Job Description
  36. RTVLASTSPLF - Retrieve ID of Last SPOOLED File for this Job
  37. RTVxxx - Retrieve Various Objects Description Table Functions
  38. WATCHLIST - List Current Watches
  39. Polymorphic Qualified Name Syntax

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

iQuery.printDF() - UDF and Procedure Published by: Bob Cozzi on 19 Jun 2019 view comments

Print a PDF to a PDF-compatible Printer

The iQuery.printPDF() UDF and Stored Procedure prints a PDF from the IFS to a phsyical printer on your network. It does this by sending the printed result to the designated Output Queue.

For convenience iQuery PRINTPDF is provided as both an SQL Function and a Stored Procedure with the same parameter set. 

Parameters

iQuery.printPDF( pdffile, outq, hold, save, copies, splfname, usrdta, addl override parameters )

The pdffile is name of the PDF on the IFS, along with the qualified directory containing the PDF. For example, '/home/orders/ord12345.pdf'

The OUTQ is the name of the output queue where the PDF file is written. An output queue name or qualified output queue name may be specified using standard CL style object qualifier, such as 'QUSRSYS/LASERJET'. The default is *JOB meaning it uses the job's current output queue setting.

The HOLD parameter is either *YES or *NO (the default is *NO). It specified whether to start printing immediately or wait until the SPOOLED image is released. When *YES is specified, the SPOOLED file is held in the output queue.

The SAVE is either *YES or *NO (the default is *NO) specifies whether the SPOOLED PDF file is saved after it is printed. The default is *NO.

The COPIES is a number value indicating the number of copies of the PDF to be printed. The default is 1.

The SPLFNAME parameter may be used to override the name of the SPOOLED file that is created on the Output Queue. Normally it is IQPDFPRINT, but to change it, specify the new SPOOLED File name on this parameter.

The USRDTA parameter may be used to override the user data of the SPOOLED file that is created on the Output Queue. The default USRDTA is set to that of the internal print file used to generate the PDF. That file IQUERYPDF in library IQUERY has 'iQueryPDF' as its user data.

The Additional Override parameter allows users to specify any other OVRPRTF parameter/option combination and have it added to the implied override that is performed. For example, to override the number of pages printed per side (i.e., Multi-Up) specify MULTIUP(2) for this parameter. You may specify as many parameters as needed, however this parameter itself is limited to 255 characters.

Note parameters that are not specified are not overridden by this UDF and will default and be subjected to any to higher-level overrides.

Returned Value

The returned value is an integer that contains the number of bytes copied to the printer (OUTPUT QUEUE).

Example

call iQuery.printPDF('/home/sales/ord541.pdf', 'QUSRSYS/PDFWRITER', '*YES','',3, 'ORDER541');

In this example, the PDF file named ORD541.PDF in the /home/sales folder on the IFS is written to the PDFWRITE output queue as a SPOOLED file named "ORDER541", and it is held. The number of copies is set to 3.

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS