Download Spool Converter User Guide

Transcript
Example:
CVTSPLPDF
FROMFILE(STATEMENTS)
EMAIL(*YES)
EMAILTO(*EMAILSQL)
EMAILSQL(‘select EMAIL, CUSNAM from CSTMST where CUSTNO = ?’
‘<:CUST_NBR:>')
SPLIT(*POS)
SPLITPOS((5 9 7))
EXITPGM(*VAR)
EXITPGMPRM(*POS)
EXITPGMPOS((1 5 9 7 CUST_NBR))
Here, a spooled file called STATEMENTS is being converted to PDF and emailed.
The spooled file contains a batch of customer account statements, and each
separate statement needs to be emailed to the appropriate customer, which is
different in each case.
The spooled file contains the customer number on line 5, position 9 for 7 characters,
and a new PDF is started every time this value changes. The same value is also
extracted from page 1 of the customer statement at run time by means of the
EXITPGMPOS parameter, and given the user-defined name CUST_NBR.
The EMAILTO(*EMAILSQL) option and associated EMAILSQL parameter indicate
that the email address information to be used is to be retrieved at run time by
executing the SQL statement specified on the EMAILSQL parameter, namely:
select EMAIL, CUSNAM from CSTMST where CUSTNO = ?
This SQL statement contains a single ? parameter marker corresponding to the
value of the customer number.
The second part of the EMAILSQL parameter indicates that the ? parameter marker
should be replaced at run time by the value of the CUST_NBR CoolSpools variable.
Note that it would be possible to specify the SQL statement in the form:
select EMAIL, CUSNAM from CSTMST where CUSTNO = <:CUST_NBR:>
rather than using a ? parameter marker, but this is not so efficient, as it requires the
SQL statement to be prepared each time it is run rather than just once.
CoolSpools Spool Converter User Guide V6R1
www.ariadnesoftware.co.uk
Page: 144