The topics covered in this episode of technical tips are:
- Duplex printing: Introduction
- InterForm400: Duplex setup
1.Duplex Printing: Introduction.
Both InterForm400 and InterFormNG can print in duplex i.e. being able to print on both back and front of the paper – provided that you use duplex printer of course.
The alternative to duplex is called simplex printing – i.e. printing only on the front of each paper.
Duplex is normally used in these scenarios:
- Scenario 1: To save paper, or to reduce costs for stamps (because of the reduced weight): Here the input data is printed on both back and front of each physical paper.
- Scenario 2: To include additional, fixed data like ‘Terms and Conditions’ on the back of either the first or the last page of the print out. This extra page does not include any variable input data. This will be covered in a future Technical tip.
If you print input data on both back and front (scenario 1), then a special situation might occur:
If you imagine that you have multiple documents in a single input file, then you need to make sure that you are not mixing different documents on the same physical piece of paper. If you e.g. first print a single page invoice for customer A and then another invoice for customer B, then it would be a problem if the second invoice was printed on the back of the first invoice.
If you only are getting a single document inside each input file, then this is not an issue. But it might be good idea to build up the printing process to solve this challenge, if it should occur.
Both InterForm400 and InterFormNG includes standard functionality to solve this potential problem. In the next sections the solutions are described.
2.InterForm400: Duplex Setup.
Follow these simple instructions to setup duplex option (Scenario 1) and the solution to the challenge described above – for InterForm400:
In order to be able to print in duplex, you first need this:
- The file set you use in InterForm400 must have duplex enabled. You set that up via option 2. Work with file sets on the administration menu.
- The printer type you use for the merge in InterForm400 must be a duplex printer type. The duplex printer types in InterForm400 includes a ‘D’: HP4D, HP4D_PJL and HP4500D.
For this specific duplex type (scenario 1 referred to in the previous section) you need to consider this:
In order to print in duplex, you need to enable duplex on the overlay(s) used and set the correct duplex type:
The duplex type should be ‘Long binding’ or ‘Short binding’ and ‘Forced Front Page’ must be disabled. (You can use a duplex margin to make extra room for stapling or holes in the paper).
If you want to avoid mixing two documents on the same physical page, then you need to introduce two different overlays: One overlay (OVL1) to be selected for the first page of a new document, and another overlay (OVL2) for any other page. Therefore, you need something unique for the first page of a document, to select OVL1 in an overlay selector for the first page of a document. If we consider the InterForm400 demo spooled file (created via the service menu), then you can use the text in line 3 position 72 to 73 to verify, if this is the first page of a document:
(Remember to make sure, that the condition is not true for page number 11, 21..etc e.g. by including a space in the comparison like below – here we assume, that the number is left adjusted).
The condition for OVL2 should be a dummy condition that is always true. You can make OVL2 a complete copy of OVL1 if you insert a reference in OVL2 to OVL1 as an unconditioned overlay (S=Suboverlay).
The final thing is to activate ‘Forced front page’ for OVL1 and disable the same for OVL2:
Now you are ready and you can implement the merge, by referring to the overlay selector.
Topics covered in the last episode are:
- InterForm400: Another use of the concat element
- InterForm400: More use of the concat element
- The STRWTRCHK option in InterForm400 and OS400 upgrades
- InterForm400: Use printer type HP4500 or HP4500D for color printing – not HP5C
- InterForm400: Correcting the time of outgoing emails
- Cookbook update: Save and restore spooled files without InterForm400
- Critical vulnerability found in the way Microsoft Windows handles printer drivers
- InterForm400: Replacement for IBM Advanced Function Printing Utilities
- InterForm400: Protecting the generated emails and PDF files
- InterForm400: Lookup in an XML file with the RTVPRPFE command
- InterForm400: PTFs to extend functionality of 2016 versions
- InterForm400: How to fix preview problems
- Interesting finding from the InterForm Development & Satisfaction Survey
- The Modules
1. InterForm400: Another use of the concat element.
A customer had a special requirement the other day. They wanted to remap some spooled file text form the middle of the page, but that should be conditioned by text found in the top of the spooled file page. That is usually a bit of a challenge, but after considering a bit, I found that the concat element can (also) help you there:
The remap window (and conditioned overlays) normally use a condition, that must be found in the same spooled file line (or just above) the spooled file data, that you want to manipulate, but the concat element actually offers the possibility to condition the concat, on data found anywhere in the spooled file – independently of the data, that you want to remap:(Below we use the InterForm400 demo spooled file, that you can generate from the InterForm400 service menu)
The condition in this example is, that the text in position 8-23 in line 6 must be ‘Florence Flowers’. Only on the pages where this is found, the concat will be inserted.
The spooled file text that we ‘remap’ in the concat is name of the contact person, which is found further down on the spooled file. The condition is true on page 2 and 3:
We refer to the contact person via a concat detail line:
In this way the concat is ‘remapping’ Susan Sunflower’ on page 2 and ‘Wolly Weed’ on page 3.
2. InterForm400: More use of the concat element
To follow on from the above we wanted to included some inspiration of what you can use the concat element for, but it can actually do more than just combine data from different places in the input spooled file. Here are a couple of examples:
- It is possible to insert a condition on the ‘header’ of the concat. That condition can, similar the conditioned overlay, remap window and tabulators, be a combination of up to 4 conditions on the same spooled file line. The condition on the concat header can be used to decide, if the complete barcode should be included in the output or not.
- It is also possible to insert conditions on the detail level, when each spooled file text is retrieved from the spooled file. Here you can test for the text in the spooled file on the same spooled file line.
- When you insert a conditioned detail element in a concat, then you can also tell InterForm400, if an element is required or not. This means, that if the condition of a detail element is not met, then you decide if the complete concat should be ignored (required). That can e.g. be used with a barcode, so that the concat barcode will only be included if all the required fields are available.
- With the 2D barcodes you can define a special ASCII hex code prefix, which triggers InterForm400 to convert the next 2 characters into an ASCII character with this hex code. That can e.g. be used, if you want to insert unprintable characters like e.g. Hex 05 in the barcode to proceed some spooled file data in order to state what kind of data it is.
- When you use a concat in a conditioned overlay, you can even tell InterForm400, if the data for the concat should be found all over in the spooled file or in the spooled file lines, that are known in the conditioned overlay (relative spooled file lines).
- To sum up: The concat is so flexible, so that it is very likely, that you can build up your dynamic barcodes without the need to change your printing programs – and you do not need to call a InterForm400 user program to create a new, temporary spooled file either.
3. The STRWTRCHK option in InterForm400 and OS400 upgrades
There is a classic discussion around how you should implement automatic processing in InterForm400. There are mainly 2 ways to do that:
- An extra Outq pr. printer: By creating an additional output queue for each physical printer, so that Auto Forms Control monitors an input queue (without a printer attached) and place the merged spooled files on another output queue with a similar name. The input (output) queue might e.g. be named PRT01_IN and the output (output) queue might be named PRT01.
The naming standard is of course free, so some customers are even naming the input queue e.g. PRT01 and renaming the output queue connected to the printer to e.g. PRT01_OUT – in order not to have any change at all in the printing programs.
- Share output queues between the printer and AFC: Some customers do not want to create any additional output queues, so they have chosen the special solution where Auto Forms Control (AFC) and the physical printer is sharing the same output queue.
In order for this to work you need to change the STRPRTWTR and the STRRMTWTR commands, so that the printer writer job only prints out spooled files with a specific form type. That is something, which you can activate in the InterForm400 configuration, where InterForm400 will change the STRRMTWTR and STRPRTWTR commands and add a call to the program APF3812/STRWTRCHK as the validity-checking program. This program will then ensure, that when you start a writer job, then the writer will only print out spooled files with a specific form type (as stated in the InterForm400 configuration) – if the same output queue is monitored by AFC.
My personal favorite is the first suggestion: To create an extra output queue. This is also how the majority of our customers are running.
If you are using option 2, then you could consider this:
- To copy the STRRMTWTR and STRPRTWTR commands to another library than QSYS, and place that library higher in the library list to avoid changing the original OS400 commands.
- In case of an OS400 upgrade the STRPRTWTR/STRRMTWTR commands may also be overwritten and suddenly you will print out only unmerged spooled files, as the writers will print out spooled files with any form type. To solve this you can go through the InterForm400 configuration to reactivate this feature.
- If you want to remove the InterForm400 and the APF3812 library, then you need first to disable the STRWTRCHK option in the InterForm400 configuration.
If you do not disable that, then the commands will still try to find the APF3812/STRWTRCHK programs; the commands will fail and no writerjobs can be started, before you remove the reference to this program.
4. InterForm400: Use printer type HP4500 or HP4500D for color printing – not HP5C
If you want to print in color in InterForm400, then you should always consider the HP4500 (or HP4500D) printer types over HP5C. One reason to stay away from HP5C is, that the PCL data stream is built for the 20+ year old HP Color Laserjet 5 printer. One important limitation of this is, that the printer is only able to print in 300 DPI, so you will get a problem, if you try to print 600 DPI images with this printer type.
In short: Use the printer type HP4500 (or HP4500D), if you want to print in color with InterForm400. Currently we keep the printer type to be backwards compatible.
5. InterForm400: Correcting the time of outgoing emails
InterForm400 is used widely to send out emails, but once in a while customers are complaining, that the time stamp of the outgoing emails are several hours wrong. This is in spite of the fact that the time is set correctly on the IBM i.
Of course it is not a problem in InterForm400, but it is related to the time zone setting of the IBM i. You can set the time and time zone via the WRKSYSVAL command, and relevant system values are: QTIME and QTIMZON.
** Warning **. You should not change any system value without the approval of the system administrator. A change of a system value may have some side effects, which you do not see right away, so think twice before you change these or any other system value. InterForm A/S cannot be held responsible for any problems or loss of data that are directly or indirectly caused by the suggestions below.
Normally the QTIME setting is set correctly, so when you compare the time of the IBM i with the local time, then the time is fine. The real problem is in the QTIMZON setting. You need to verify, if this is correct.
You should then consider changing the QTIMZON to the correct time zone, but take care: When you change QTIMZON, the value of QTIME will also change (automatically) to adapt to the new value, so you will probably need to correct QTIME immediately after changing QTIMZON.
In older OS400 versions (pre V5R3), you need to change the system value, QUTCOFFSET instead of QTIMZON.
Remember that changing the time can affect the logic of programs (time stamps might be affected) and even job schedulers, so you should consider to do the change when the machine is not busy.
6. Cookbook update: Save and restore spooled files without InterForm400
It has been possible to save and restore spooled files with the normal SAVOBJ command from V5R4, but many people are not aware of this. For our business partners, this feature is used e.g. to get a copy of spooled files from potential customers.
It simply works like a normal SAVOBJ for an output queue, where you need to specify SPLFDTA(*ALL) on the SAVOBJ command and
SPLFDTA(*NEW) on the RSTOBJ command. With this, any spooled file on the output queue will also be saved.
For some it is also a challenge to get the save file out to the IFS as a stream file e.g. for emailing, so I have also described how that can be done.
This is now included in a new update of the cookbook.
The updated cookbook can be downloaded here:
7. Critical vulnerability found in the way Microsoft Windows handles printer drivers
Vectra Threat Labs have discovered a critical vulnerability (CVE-2016-3238) that is affecting all supported releases of Microsoft Windows.
The way end users connect to printers from Windows, allows attackers from within your local network - or even directly from the Internet, to place malicious driver files on your printer. This enables them to gain control to end-user devices connected to the printer, all across your internal network.
We recommend you read the whole article by Vectra Threat Labs here.
8. InterForm400: Replacement for IBM Advanced Function Printing Utilities
IBM i version 7.2 was the last release with IBM support for Advanced Function Printing Utilities (AFP) *.
AFP provides IBM i users with the basic functionalities of creating, designing and managing different resources, such as overlays for electronic forms and labels, etc.
InterForm400 is an enhanced alternative for AFP, capable of delivering the same standard functionalities - including a much wider selection of advanced Output Management features natively from the IBM i.
We have already helped several satisfied customers migrate to InterForm400.
*Source: IBM® Knowledge Center: IBM i 7.3 Release notes - June 29, 2016
9. InterForm400: How to protect the generated PDF files and emails
In general, the IBM i is not heavily haunted by viruses. However, the IFS is for the PCs like any other file server. If a PC e.g. runs a trojan horse, that encrypts and password protects any file it can reach (forcing you to pay a ransom for the password), then the files in the IFS can be hit like any other files.
One advice is to have a good and frequent backup. Another advice will be to make sure that the majority of the users only are able to read the contents in the IFS, but not modify it. You can e.g. use the CHGAUT command to change the authority of a folder (and change the authority of all subfolders and stream files inside).
When it comes to InterForm400, there is a dilemma: When an input spooled file is processed in Auto Forms Control (AFC), then the default way for InterForm400 to handle the spooled file is change the current user of the job, to the spooled file owner. The advantage with this is that any spooled file and other object created by the AFC job, will be owned by the same user profile as the original spooled file. This makes it easier for the users to track the outcome of their work, and for anyone else to see who created what. The dilemma now is, that if AFC should create a stream file in the IFS on the behalf of a normal user, then that user would need write authority, and this is exactly what we want to avoid...
The solution for PDF files
One solution is to tell InterForm400 to use another user profile, while creating the PDF files. You can do that in AFC, when you setup the call of the PDF file naming definition:
The default user is *SPLFOWNER, which of course refers to the spooled file owner. In this case we are using another special user profile with write authority instead, here called IFS_WRITER. You should never sign on as IFS_WRITER, and the user profile could be disabled, without a password, and with no special authorities – except write authority to the folder in question: (You can use the CHGAUT and WRKAUT commands to set and display the authorities).
The owner of the created PDF files will however be IFS_WRITER and not the original spooled file owner.
The solution for emails
The emails generated by InterForm400 are stored in the IFS inside /APF3812mail/Outbox (and /APF3812mail/Log if you set save=*YES, when you create the email).
Like for the PDF files, we have a problem when we need to create new emails (.eml files) in the outbox directory. The spooled file owner should only have read authority – not write authority. So first, we need a user profile with write authority, which we can use whenever we want to create or delete emails. In this example I have reused the IFS_WRITER user profile:
Now when we create the emails in AFC, we need to refer to a user profile with write authority to the outbox directory like so:
The email address of the sender (inside the email) is untouched, so that is not affected by the change of user profile. The normal users can still delete emails (with status *HELD or *READY) from the WRKMAILLOG command, as the email files in the IFS are not removed until the next time you run the APF3812/CLRMAILLOG command, which you should of course do on a regular basis.
10. InterForm400: Lookup in an XML file with the RTVPRPFE command
Whenever it makes sense, new functions in InterFormNG are also implemented in InterForm400 and vice versa. One example of this is the ability to lookup in a list with a key and get back a text stored for that key. That has been possible for many years in InterFormNG, and now with the 2016 versions you can do (about) the same in InterForm400.
You want to include/use information in a program, that can easily be maintained directly by end users. One way is to create a normal DB2 database, but then you need to create an extra program and a display file to enable users to edit the file. The actual lookup in the database might also be a bit of a task, if you want to do it from a CL program.
The InterForm400 alternative:
Instead of using a normal DB2 database, you can also provide an XML file, that your users can edit. The contents need to be like this XML file:
The structure of the xml file must be defined like above with the “properties” node and “entry” nodes as children. Each entry node has set the “key” attribute to the value, that you want to use for the lookup. The XML file can contain information about the encoding, but please note, that InterForm400 will not use that information, but instead look at the attribute of the stream file, so if the XML file is e.g. UTF-8 encoded, then you will need to make sure, that the CCSID of the XML file is correct. If e.g. the stream file is UTF-8 encoded, then you need to make sure, that the CCSID is set to 1208, which you can verify with WRKLNK and then use option 8 to display the attributes:
- or with the command: QSH CMD('attr /APF3812Home/Work/lookup.xml CCSID’).
You can change the CCSID with this command:
CHGATR OBJ('/APF3812Home/Work/lookup.xml') ATR(*CCSID) VALUE(1208)
When you want to look up into the XML file, then you can do that with the RTVPRPFE command e.g. from a split exit program like this:
The key value (which here is ‘DE_OC’) could also be retrieved from the spooled file via one of the entry variables, so that the language of the returned text fits the preferred language of the customer. (If in doubt: The example above will insert the text ‘Auftragsbestätigung’ in the new spooled file).
The text found in the XML file can of course also be some special offer of the week, that the sales department are dynamically updating – or it can be used as a part of an &&IMG command to dynamically include an image in the final output. (For more details about dynamic images you can refer to Appendix H in the InterForm400 manual).
11. InterForm400: PTFs to extend functionality of 2016 versions
InterForm400 functionality is usually the same for the official year versions, but sometimes we do add extra, new functionality (or solve issues) with a PTF. Recently we have added a few PTFs for InterForm400 that I think might be interesting for many customers.
Note: Instead of installing these PTFs, you can upgrade to the latest 2016 version (2016M05), in which these PTFs are included.
The PTFs must be installed in numeric order (starting with the lowest numbers). The interesting PTFs are:
PTF 5031: Remove leading spaces from variables in email finish definitions.
In previous versions any leading spaces in variables are also included in the email output, but with this PTF any leading spaces are trimmed.
Download link: http://download.interform400.com/shares/PTFs/APF5031.ZIP
PTF 5032: Support for large PDF files.
Until now the maximum size of a PDF file is 2Gb, but with this PTF the maximum size is increased from 2Gb to 10Gb. The extension was needed for a customer creating a 230.000 page long PDF file.
Download link: http://download.interform400.com/shares/PTFs/APF5032.ZIP
PTF 5034: In some, special situations the last concat in a conditioned overlay does not work in PDF. This is fixed with this PTF.
Download link: http://download.interform400.com/shares/PTFs/APF5034.ZIP
PTF 5036: Conditioned overlay/remap was not called in PCL after a concat.
In some situations a remap window/onditioned overlay is not called when using the new concat element – in PCL output. This problem is fixed with this PTF.
Download link: http://download.interform400.com/shares/PTFs/APF5036.ZIP
Procedure to install PTFs:
In order to install PTFs in InterForm400 you can use this procedure:
- Upload the zip file in the IFS inside /APF3812Home/PTFs.
- Load the PTF via these options in InterForm400:
12. Service functions
50. Apply PTF from the /APF3812Home/PTFs directory
Type in the PTF number e.g. 5031, press Enter and confirm installation with F10.
12. InterForm400: How to fix preview problems
It is possible to preview the merged result in a few places in InterForm400:
- In the green screen designer with F14
- From the APF3812/APFWRKOUTQ command with 5=Display for a merged spooled file
- From the graphical designer
In order to do the preview, InterForm400 will need to know the identification of the IBM i (as seen from the PC). An important prerequisite is that you have netserver access to the IFS, which can e.g. be done by mapping a network drive to a shared folder in the IFS. Another prerequisite is, that you use the same identification (either Netserver name or IP-address) for the IBM i in all of these places:
- In the InterForm400 configuration
- When you setup Netserver access e.g. via a mapped drive
- When you start up the graphical designer
You decide if you want to use the IP-address or the server name, but you need to use the same in all of the places for trouble-free previewing.
Additional help is included in the manual and the cookbook.
13. Interesting finding from our Development & Satisfaction Survey
One of the interesting facts the survey has shown, is the number customers considering changing ERP:
20 percent of all the participants are considering changing their ERP system.
Fortunately, no matter which new solution you are considering - InterForm can provide you an Output Management solution that you can use on any platform with any ERP system.
Read about our platform independent solution - InterFormNG
14. The Modules
Embedded any file format into PDF files
Digital Signature / PDF Security
PDF encryption, password protection and digital signatures
Easy spool file conversion to Excel for IBM i
Simple and easy mail merge for IBM i (OfficeVision replacement)
XML generates synergy between you and your clients
Connect any printer to InterForm400
Intelligent spool archiving for InterForm400
Distributes documents directly via fax (Batch)
Distributes documents directly via fax (Batch, Interactive & multiple fax lines)