Normal spooled files can be loaded and processed directly in InterFormNG2, but there is one deviation from this and this concerns spooled files where the attribute, Variable CPI is Y.
You can identify such spooled files if you select option 8=Attributes for the spooled file e.g. from WRKOUTQ or WRKSPLF and then press <Page Down> until you see this:
Here you might see a Y for Variable CPI, which indicates that this is a special spooled file, which must be handled in a special way.
The procedure is, that you need to call a script to correct the spooled file before it can be used in either the designer and for merging in the workflow.
So in order to use the spooled file in the designer you will need to call the script mentioned below and then save the changed spooled file as a document resource in InterFormNG2.
A prerequisite for calling the Java script is, that the
system settings allow this:
Next you need to create the script.
The script is included here as text:

var message = payload.toString();
var newPayload = '';
var linearr = message.split('\n');
for (var i = 0; i < linearr.length; i++) {
var combinedLine = '';
var thisLine = linearr[i].trim();
if (thisLine.indexOf('<line>') != -1) {
thisLine = thisLine.replace('<line>', '')
thisLine = thisLine.replace('</line>', '')
var originalLine = thisLine;
var idx = thisLine.indexOf('CPI');
// Line has CPI information if it contains the exact text CPI with a digit in front
var isCpiLine = idx > 0 && thisLine.charAt(idx - 1) >= '0' && thisLine.charAt(idx - 1) <= '9'
if (!isCpiLine) {
combinedLine = thisLine;
} else while (idx != -1) {
var newLine = thisLine.substring(0, idx + 3);
thisLine = thisLine.substring(idx + 3);
if (combinedLine == '') {
combinedLine = newLine;
while (combinedLine.length < originalLine.length) {
combinedLine = combinedLine + ' ';
}
} else {
for (var l = 0; l < newLine.length; l++) {
var curchar = newLine.charAt(l);
if (curchar != ' ') {
combinedLine = combinedLine.substring(0, l) + curchar + combinedLine.substring(l + 1);
}
}
}
idx = thisLine.indexOf('CPI');
}
// Trim end
if (isCpiLine) {
while (combinedLine.length > 0 && combinedLine.charAt(combinedLine.length - 1) == ' ') {
combinedLine = combinedLine.substring(0, combinedLine.length - 1);
}
}
combinedLine = '<line>' + combinedLine + '</line>';
} else {
combinedLine = thisLine;
}
newPayload = newPayload + combinedLine + '\n';
}
payload.setString(newPayload);
To create the script you can copy the text above, paste it into e.g. Notepad or Notepad++ and then save it as e.g. merge_splf_overprint_ng2 2.js
Now we can refer to the script in workflows, that loads the spooled file like below:
Related Articles
Spooled files in the workflow
This section covers all topics concerning automatic processing of spooled files in the InterFormNG2 workflow: How to monitor an output queue. Load a sample spooled file in the workflow editor Convert a variable CPI spooled file How to condition the ...
Spooled files in the designer
You can process spooled files in InterFormNG2, if you have installed InterFormNG2 on the IBM i platform. The spooled file actions related to the designer are: How to load a spooled file in the designer. How to map spooled file data in the designer. ...
Spooled files and duplex
If you want to combine spooled file processing with duplex, then you first need to consider which duplex option, that you want to implement. In the scenarios below it is assumed, that you want to process the input spooled file in the usual way: That ...
Handling large spooled files in parallel
The processing of spooled files on an output queue is single threaded, so if you are processing larger spooled files (that takes longer to process and print), then smaller spooled files on the same output queue might wait for the processing of a ...
Post-process spooled file
As a part of spooled file processing in InterFormNG2 on the IBM i platform, you might want to delete, hold or move the input spooled file to let the end user know, that the specific spooled file has been successfully processed. You can also change a ...