Tip of the Month
Emailing PDF files in NOMAD
Last month, we showed you an easy way to generate a PDF report using NOMAD, and promised to tell you this month how to email it. Here is a procedure to do just that:
/* generate report - see last month's newsletter */
database newcmpny BLUE;
file define textin = textin data vfile;
list by type sum(cost) on textin;
file define pdfout = my pdf vfile;
transform text to pdf;
/* define email file-id and SMTP server on VM and z/OS */
file define emailout email create length 32000 ibmvarying
alloc 'SYSOUT(x) WRITER(SMTP_server_started_task_on_z/OS)';
&smtpname = 'SMTP_server_userid_on_VM';
/* specify email with multiple parts and create first part */
subject 'Report of equipment costs'
contenttype 'multipart/mixed; boundary="xyzzy"'
write ' ' fold 'The report is attached, my liege.'
/* add PDF generated above as attachment to email */
write ' ' on emailout;
file copy pdfout emailout encode 'base64' wrap to 76;
/* send the email */
file clear emailout;
That's it! The king will receive an email like the following gmail example:
For more information on using NOMAD to send email, see Chapter 9 of the UltraQuest & NOMAD Reference Manual. In particular, Example 11 demonstrates sending worksheet, Microsoft Word, and formatted HTML attachments.
Note: the UltraQuest product from Select Business Solutions can email a PDF report with the click of a button.