GENERATE_PDF scalar function
The GENERATE_PDF scalar function generates a PDF file in the Integrated File System containing the content of a spooled file.
This function requires the following product: 5770TS1 - Option 1 - Transform Services - AFP to PDF Transform
Authorization: This scalar function uses the Copy Spooled File (CPYSPLF) CL command. Any authority requirements for the CL command apply to the use of this function.
- job-name
- A character string containing a qualified job name. Can contain the following special value:
- *
- Use the name of the current job.
- spooled-file-name
- A character string containing the name of the spooled file.
- spooled-file-number
- The number of the spooled file. Can contain the following special value:
- *LAST
- The spooled file with the highest number with a name matching spooled-file-name is selected.
- path-name
- A character string containing the name of the path where the result PDF file is to be written.
Note
This function is provided in the SYSTOOLS schema as an example of how spooled file data can be converted to PDF format by embedding the CPYSPLF CL command in an SQL scalar function. Similar to other Db2 for i provided tools within SYSTOOLS, the SQL source can be extracted and used as a model for building similar helper functions, or to create a customized version within a user-specified schema.
Example
VALUES SYSTOOLS.GENERATE_PDF(
JOB_NAME => '908049/QUSER/QZDASOINIT',
SPOOLED_FILE_NAME => 'PGMA',
SPOOLED_FILE_NUMBER => 2,
PATH_NAME => '/usr/listing1');