Midrange News for the IBM i Community

Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
SQL iQuery Documentation - UDF and UDTF
has no ratings.
Published: 19 Jun 2019
Revised: 20 Jun 2019 - 487 days ago
Last viewed on: 18 Oct 2020 (214 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
  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.

cpytopdf() - Stored Procedure Published by: Bob Cozzi on 19 Jun 2019 view comments

Copy SPOOLED File to PDF File on the IFS

The iQuery.cpytopdf() Stored Procedure copies the specified SPOOLED file to the IFS as a PDF. Effectively the SPOOLED file is converted into a PDF and saved on the IFS.

This function uses the CPYSPLF CL command and all authority and access rights needed for CPYSPLF would be necessary for CPYTOPDF.


iQuery.cpytopdf( pdffile, splfName, splnbr, qualified-job-name ) 

The pdffile is name of the PDF that will be created on the IFS. For example: '/home/orders/ord12345.pdf'

The SPLFNAME is the name of the SPOLLED file that is to be converted to PDF. This is the SPOOLED File name attribute of the output queue entry.

The SLNBR parameter is the SPOOLED file number. The default is -1 which means *LAST, but may also be 0 to indicate *ONLY. Otherwise, the SPOOLED File Number must be specified.

The JOB is either qualified job name. It defaults to the current job if no value is specified.



call iQuery.cpytoPDF('/home/sales/orderdetails.pdf', 'ORDER'); 

In this example, the PDF file named OrderDetails.PDF is created from the SPOOLED file named ORDER that is the last SPLNBR (SPOOLED File Number) with that name. It looks for the SPOOLED file in the current job; that is the job calling the CPYTOPDF Stored Procedure.


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