Repository navigation
Spooldoc 0.6.0: lookups from Db2 for i, and email alerts #158
ronistrom
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Spooldoc 0.6.0 is out. A job can now read what the printed page leaves out from Db2 for i: the customer's email address, the payment terms, an item text in the customer's language. The program and its spooled file stay as they are. Spooldoc can also email you when a run fails or watching stops, and again when it works. Nothing breaks: the upgrade is a pull and a restart.
What changed
Lookups from Db2 for i. A lookup is one SELECT statement. It runs after the definition has read each page group and before the templates render it. It takes values the definition read, such as the customer number, and adds the rows it finds to the page group's data. Templates, file names and email fields use them like any other field, so an email destination can send each invoice to
{d.pg.customer.EMAIL}although the invoice never printed it. The values are bound as parameters, never written into the SQL, and the statement runs on a read-only connection. Lookups have a step of their own in the job builder, between Extract and Render. Lookups has the details.Test before you save. In the SQL, each parameter shows the value it gets from the page group on screen. Test checks the statement on the IBM i and runs it with those values. It shows each parameter with its Db2 type, the rows found, the time taken and the tags to write in a template. A version can be saved only when every lookup was tested after its last change. Test has the details.
Row lookups. A lookup can run once per row of a table, such as the lines of a pick list, and read the result of an earlier lookup. With
:customer.LANG, each line gets its item text in the customer's language. A row lookup runs once for each set of values in a run, not once per row. Row lookups has the details.A missing row is not a silent gap. When a lookup finds no row, it stops the run, warns and leaves the value empty, or leaves it empty, as you choose. A warning shows on the Lookups step for the page group on screen and in the job log, with the document it is about: "No row in customer for customerNo 10007 (pick-list-700005)." A later lookup that reads the missing one does not run, and the first warning names it. Db2 for i errors say what to do: a missing table names the table and its library, and a missing authority names the
GRTOBJAUTthat grants it. When no row is found and Errors have the details.Email alerts. Enter one or more addresses under Settings, Alerts, and Spooldoc emails you when something on the Home page's Needs attention list starts. A run that fails or ends with a warning alerts at once. A server that cannot be reached, a job that cannot process new spooled files, or an output queue that dropped to polling alerts after 5 minutes, so a short break wakes nobody. Each problem sends one email when it starts and one when it is fixed, such as "MYJOB works again. Run 131 succeeded at 10:05 UTC. 3 runs failed since 09:14 UTC." More failed runs of the same job send nothing in between. Send test alert checks the setup. Alerts has the details.
Fixes. The saved SMTP password goes only to the server and user it was saved for: a change of host, port or user name under Settings now asks for the password again. The locks that let one watcher work on a job, and one cleanup run at a time, are released again; before, a lock could stay held after its work was done. The template check no longer slows down on a long template without line breaks, such as minified HTML, with many problems.
All changes are in the release notes.
Upgrading
Take a
pg_dump, then pullghcr.io/strom-capital/spooldoc:0.6.0and start it. The server applies the new migration. Nothing else needs you: jobs from 0.5 open and run as before, and their Lookups step reads None.*USEon each table the query reads and*EXECUTEon its library. Authority has the commands.APP_URLis set.Tell us
Questions go to Q&A, ideas to Ideas, bugs to the issues. We most want to hear about a lookup you could not write: a table, a join or a value that did not come out as you expected. Replace real library, table, host and customer names before you paste it.
All reactions