InterFormNG2 is shipped with two predefined commands, that are both quite generic as you can freely define exactly what the commands do in the referenced workflows.
The two commands are:
Both commands do nothing unless you create a workflow to match them and the parameters, that you have setup.
The most important thing is, that you refer to the path of the workflow in the first parameter of the commands: NG2 endpoint (COMMAND field).
The parameters of the commands are mapped into workflow variables.
Merge spooled file and overlay (NG2CMD) Type choices, press Enter. NG2 Endpoint . . . . . . . . . . COMMAND Spooled file . . . . . . . . . . FILE *NONE Name, *NONE Job name . . . . . . . . . . . . JOB * Name, * User . . . . . . . . . . . . . Name Job number . . . . . . . . . . 000000-999999 Spooled file number . . . . . . SPLNBR *ONLY Number, *ONLY, *LAST Job system name . . . . . . . . JOBSYSNAME *CURRENT Name, *CURRENT Spooled file created: CRTDATE Creation date . . . . . . . . *ONLY Date, *ONLY Creation time . . . . . . . . Time, *ONLY Code page . . . . . . . . . . . CODPAG *INPUT Number, *INPUT To stream file . . . . . . . . . TOSTMF F1 . . . . . . . . . . . . . . . FILE1 More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
Merge spooled file and overlay (NG2CMD) Type choices, press Enter. F2 . . . . . . . . . . . . . . . FILE2 F3 . . . . . . . . . . . . . . . FILE3 F4 . . . . . . . . . . . . . . . FILE4 F5 . . . . . . . . . . . . . . . FILE5 F6 . . . . . . . . . . . . . . . FILE6 F7 . . . . . . . . . . . . . . . FILE7 F8 . . . . . . . . . . . . . . . FILE8 F9 . . . . . . . . . . . . . . . FILE9 More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
Merge spooled file and overlay (NG2CMD) Type choices, press Enter. F10 . . . . . . . . . . . . . . FILE10 P1 . . . . . . . . . . . . . . . PARM1 P2 . . . . . . . . . . . . . . . PARM2 P3 . . . . . . . . . . . . . . . PARM3 P4 . . . . . . . . . . . . . . . PARM4 More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
Merge spooled file and overlay (NG2CMD) Type choices, press Enter. P30 . . . . . . . . . . . . . . PARM30 Attachment name . . . . . . . . ATTACHNAME Print copies . . . . . . . . . . COPIES Email server . . . . . . . . . . MAILSERVER Email subject . . . . . . . . . SUBJECT More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
Merge spooled file and overlay (NG2CMD) Type choices, press Enter. Email from . . . . . . . . . . . MAILFROM Email to . . . . . . . . . . . . MAILTO Email CC . . . . . . . . . . . . MAILCC Email BCC . . . . . . . . . . . MAILBCC More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
Merge spooled file and overlay (NG2CMD) Type choices, press Enter. Email template . . . . . . . . . MAILTEMPL Printer name . . . . . . . . . . PRINTER File name . . . . . . . . . . . FILE Directory . . . . . . . . . . . DIR Template . . . . . . . . . . . . TEMPLATE More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
Merge spooled file and overlay (NG2CMD) Type choices, press Enter. Input file . . . . . . . . . . . INFILE File conflict resolution . . . . CONFLICT Log info key . . . . . . . . . . LOGINFO Configuration file . . . . . . . CFGFILE Bottom F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
PGM DSPJOBLOG OUTPUT(*PRINT) IFORMNG2/NG2CMD COMMAND(DUMP) FILE(QPJOBLOG) + SPLNBR(*LAST) TOSTMF('/iformng2/tofile') + FILE1('/apf3812home/view/kse.pdf') + FILE2('F2') FILE3(F3) FILE4(F4) FILE5(F5) + FILE6(F6) FILE7(F7) FILE8(F8) FILE9(F9) + FILE10(F10) PARM1('P01') PARM2('P02') + PARM3('P03') PARM4('P04') PARM5('P05') + PARM6('P06') PARM7('P07') PARM8('P08') + PARM9('P09') PARM10('P10') PARM11('P11') + PARM12('P12') PARM13('P13') PARM14('P14') + PARM15('P15') PARM16('P16') PARM17('P17') + PARM18('P18') PARM19('P19') PARM20('P20') + PARM21('P21') PARM22('P22') PARM23('P23') + PARM24('P24') PARM25('P25') PARM26('P26') + PARM27('P27') PARM28('P28') PARM29('P29') + PARM30('P30') ATTACHNAME(ATTACHMENTNAME) + COPIES(127) MAILSERVER(GMAIL) + SUBJECT('test subject') + MAILFROM(EMAILFROM) MAILTO(EMAILTO) + MAILCC(EMAILCC) MAILBCC(EMAILBCC) + MAILTEMPL(EMAILTEMPLATE) PRINTER(PRINTER) + OUTFILE(FILENAME) DIR(DIRECTORY) + TEMPLATE(TEMPLATE.IFT) INFILE(INPUTFILE) + CONFLICT(CONFLICT) LOGINFO(LOGINFOKEY) ENDPGM
A template in InterFormNG2, which can be merged with the spooled file and present the contents of the spooled file.
A workflow, which can be called by the IFORMNG2/NG2CMD command. This workflow will create and send the email.
A small CL program which creates a spooled file and immediately calls the workflow above via the IFORMNG2/NG2CMD command.
PGM DSPJOBLOG OUTPUT(*PRINT) IFORMNG2/NG2CMD COMMAND(EMAIL) FILE(QPJOBLOG) + SPLNBR(*LAST) + FILE1('/apf3812home/view/kse.pdf') + ATTACHNAME(JOBLOG.PDF) MAILSERVER(GMAIL) + SUBJECT('This is my email') + MAILFROM('customremail@gmail.com') + MAILTO('customremail@gmail.com') + MAILTEMPL('defaultMailTemplate.vm') + TEMPLATE(generic.splf) ENDPGM
PGM DSPJOBLOG OUTPUT(*PRINT) IFORMNG2/NG2CMD COMMAND(EMAIL) FILE(QPJOBLOG) + SPLNBR(*LAST) + FILE1('/apf3812home/view/kse.pdf') + ATTACHNAME(JOBLOG.PDF) MAILSERVER(GMAIL) + SUBJECT('This is my email') + MAILFROM('customremail@gmail.com') + MAILTO('customremail@gmail.com') ENDPGM
PGM DSPJOBLOG OUTPUT(*PRINT) IFORMNG2/NG2CMD COMMAND(PDF) FILE(QPJOBLOG) + SPLNBR(*LAST) + TOSTMF('/iformng2/result.pdf') + TEMPLATE('generic.ift') ENDPGM
PGM DSPJOBLOG OUTPUT(*PRINT) IFORMNG2/NG2CMD COMMAND(PDF2) FILE(QPJOBLOG) + SPLNBR(*LAST) OUTFILE(WORKFLOW.PDF) + DIR('/IFORMNG2') TEMPLATE('generic.ift') + CONFLICT('Overwrite') ENDPGM
This is the file to payload workflow component. In this example we refer to the workflow variable, interform.input.file.absolute.path. This variable relates to the parameter, INFILE of the NG2CMD command.
The final workflow component creates the PDF file. For that we use the workflow component, Create PDF file. Here we use the component with these parameters:
In this component we refer to these variables:
Template
This is the template (or design), that we want to merge the input XML file with. Here we have chosen that the template (the design) is to be selected on the command, NG2CMD. The variable, com.interform400.xml.Template contains the value of the parameter, TEMPLATE of the NG2CMD command.
Output directory
This is the directory in which we want to store the PDF file, that is created by the merge between the input XML file and the referenced template. Here we refer to the variable, $interform.plugin.archiver.folderName, which contains the value of the parameter, DIR in the NG2CMD command.
Output filename
This is the name of the PDF file (without the path but including the extension), that we want to create. This is here the variable, interform.plugin.archiver.fileName, which contains the value of the parameter, OUTFILE in the NG2CMD command.
Filename conflict resolution
Here we have specified, that the output PDF file is to be overwritten, if it already exists, but this can also be set via an XPath expression.
With the setup above we can now call this workflow in InterFormNG2 with the command, IFORMNG2/NG2CMD.
This is an example where this command is called in a CL program:
/* Create the PDF file via the command. */ /* The command refers to an input XML file, that is to be merged with a */ /* template. */ PGM IFORMNG2/NG2CMD COMMAND(PDF_XML) OUTFILE(outfile.pdf) + DIR('/apf3812home/work') + TEMPLATE('Demo_XML.ift') + INFILE('/apf3812home/work/Intro_demo.xml') ENDPGM
The command has these parameters:
Command
This is the link to the workflow. This must match the path parameter of the AS400 command input component above.
Outfile
The name of the PDF file, that we want to create.
Dir
The directory in which the PDF file is to be created.
Template
The template (design) that the input XML file should be merged with.
Infile
The full path of the input XML file, that we want to merge with.
This section shows a way to print the merged result between a spooled file and a template in a workflow via a command call on the IBM i platform.
This workflow has been setup:
PGM DSPJOBLOG OUTPUT(*PRINT) IFORMNG2/NG2CMD COMMAND(PRINT) FILE(QPJOBLOG) + SPLNBR(*LAST) PRINTER('PRT08') + TEMPLATE('generic.ift') ENDPGM
TOOLSSERVER must be running in subsystem IFORMNG2 (C R)
Work with Active Jobs PMK250 27/06/24 10:09:49 CEST CPU %: 67.4 Elapsed time: 00:11:07 Active jobs: 313 Type options, press Enter. 2=Change 3=Hold 4=End 5=Work with 6=Release 7=Display message 8=Work with spooled files 13=Disconnect ... Current Opt Subsystem/Job User Type CPU % Function Status IFORMNG2 QSYS SBS .0 DEQW IFORMNG2 IFORMNG2 BCH .0 PGM-NGQ500C DEQW NG2CLEAN IFORMNG2 BCH .0 DLY-60 DLYW NG2SERVER IFORMNG2 ASJ .0 PGM-STRSVRC TIMA QP0ZSPWP IFORMNG2 BCI .0 PGM-QZSHCHLD EVTW QP0ZSPWP IFORMNG2 BCI 62.5 JVM-Properties THDW QZSHSH IFORMNG2 BCI .0 PGM-QZSHSH EVTW TOOLSHED2 IFORMNG2 BCH .0 PGM-STRTOOLSS TIMW TOOLSHED2 IFORMNG2 BCI 1.2 JVM-com.interf SELW More... Parameters or command ===> F3=Exit F5=Refresh F7=Find F10=Restart statistics F11=Display elapsed data F12=Cancel F23=More options F24=More keys
IFORMNG2 InterForm NG2 Main Menu Select one of the following: System . . . : PMK250 User . . . . : KSE Administration Version . . : 3.4.1 1. Work with monitored output queues 2. Work with XML definitions 10. Start IFORMNG2 subsystem 11. End IFORMNG2 subsystem 12. Work with IFORMNG2 subsystem 16. Save spooled file to stream file 31. Display print service log 51. Adjust CPI - *AFPDS configuration 91. License 92. NG2 installation and configuration Selection or command ===> F3=Exit F4=Prompt F9=Retrieve F12=Cancel F13=Information Assistant F16=System main menu
Configure IFORMNG2 Startup (NG2SETUP) Type choices, press Enter. IBM I Queue Monitor . . . . . . > *ACTIVE *ACTIVE, *INACTIVE, *SAME NG2-Server (Output generator) . > *ACTIVE *ACTIVE, *INACTIVE, *SAME CommandLine to NG2 . . . . . . . > *ACTIVE *ACTIVE, *INACTIVE, *SAME QIBM_QSH_CMD_OUTPUT - *JOB . . . > NONE JAVA_HOME Blank=System default > '/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit' JVM_MEMORY . . . . . . . . . . . > '-Xms2g -Xmn1g -Xmx3g' Use jt400Native.jar . . . . . . > '-Dloader.path=/QIBM/ProdData/OS400/jt400/li b/jt400Native.jar' More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
The NG2CMD command is the most generic command, where this command, NG2CPDFEML is more limited and has been prepared to generate an email with an attached PDF file.
The command runs its function via a referenced workflow, that you select via the NG2 endpoint (COMMAND) field. The NG2 Endpoint value must the the path of a
workflow that is specified for AS400 Command input.
The NG2CPDFEML command looks like the screens below.
The parameters are explained in the "Parameters of the AS400 command" section below.
Merge spooled file and overlay (NG2CPDFEML) Type choices, press Enter. NG2 Endpoint . . . . . . . . . . COMMAND Spooled file . . . . . . . . . . FILE *NONE Name, *NONE Job name . . . . . . . . . . . . JOB * Name, * User . . . . . . . . . . . . . Name Job number . . . . . . . . . . 000000-999999 Spooled file number . . . . . . SPLNBR *ONLY Number, *ONLY, *LAST Job system name . . . . . . . . JOBSYSNAME *CURRENT Name, *CURRENT Spooled file created: CRTDATE Creation date . . . . . . . . *ONLY Date, *ONLY Creation time . . . . . . . . Time, *ONLY Code page . . . . . . . . . . . CODPAG *INPUT Number, *INPUT To stream file . . . . . . . . . TOSTMF More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
Merge spooled file and overlay (NG2CPDFEML) Type choices, press Enter. Attachment name . . . . . . . . ATTACHNAME Email subject . . . . . . . . . SUBJECT Email from . . . . . . . . . . . MAILFROM Email to . . . . . . . . . . . . MAILTO _ More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
Merge spooled file and overlay (NG2CPDFEML) Type choices, press Enter. Email CC . . . . . . . . . . . . Email BCC . . . . . . . . . . . Email template . . . . . . . . . Template . . . . . . . . . . . . More... F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
Merge spooled file and overlay (NG2CPDFEML) Type choices, press Enter. P1 . . . . . . . . . . . . . . . PARM1 P2 . . . . . . . . . . . . . . . PARM2 P3 . . . . . . . . . . . . . . . PARM3 P4 . . . . . . . . . . . . . . . PARM4 P5 . . . . . . . . . . . . . . . PARM5 Bottom F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
Parameter on command | NG2 workflow variable | Description |
COMMAND (NG2 Endpoint) | N/A | Selects the workflow to execute. Identified as Path on the AS400 command input. |
Parameter on command | NG2 workflow variable | Description |
N/A | Selects the InterFormNG2 enviroment, that the command should call.
If this is not filled out: The command will search for the file ng2CommandAPI.properties in the IFS directory, /iformng2/user. If the configuration file is not found in this directory, then the file is expected to be found in the IFS directory, /iformng2/InterFormNG-shell/Core.
If this is filled out: You can enter a configuration file here, if you want to use a different configuration, than the standard configuration. The file should be placed in the IFS directory, /iformng2/user and you specify only the file name - not the path. Details of this configuration file is found in the section, Setup InterFormNG2 AS400 command API. | |
LOGINFO (Log info key) | interform.log.infointerform.log.info | An optional unique key for lookup in the list of tenant job logs. |
TEMPLATE (Template) | com.interform400.xml.Template | The InterFormNG2 template, that should be merged with the input file (e.g. XML or spooled file) |
Parameter on command | NG2 workflow variable | Description |
FILE (Spooled file) | interform.input.spooled.splf | The name of the input spooled file or *NONE if no spooled file is selected. |
JOB (Job name) | interform.input.spooled.jobName | The name of the job, that created the spooled file. * refers to the current job. |
JOB (User) | interform.input.spooled.user | The user profile, that created the spooled file. If * is used for the job, then this can be blank. |
JOB (Job number) | interform.input.spooled.jobNbr | The job number of the job, that created the spooled file. If * is used for the job, then this can be blank. |
SPLNBR (Spooled file number) | interform.input.spooled.splfNbr | The spooled file number. If * is used for the job, then this can be blank.*LAST means use the last spooled file with the specifications above and *ONLY refers to the single spooled file, that match the specification of the job and spooled file name above. |
CRTDATE (Creation date) | interform.input.spooled.crtDate | Creation date of the spooled file. |
CRTDATE (Creation time) | interform.input.spooled.crtTime | Creation time of the spooled file. |
CODPAG (Codepage) | N/A | The codepage to use when extracting data from the input spooled file. |
A lot of spooled file attributes are also retrieved, and they can used in the workflow. They are listed here.
Parameter on command | NG2 workflow variable | Description |
TOSTMF (To stream file) | N/A | Saves the payload, that the workflow returns as this file. Leave it blank, if nothing is returned or if the output e.g. is generated and save directly in the workflow. |
Parameter on command | NG2 workflow variable | Description |
PARM1..PARM30 (P1..P30) | parm_1..parm_30 | Optional input parameters, that the workflow can use as variables. |
Parameter on command | NG2 workflow variable | Description |
ATTACHNAME (Attachment name) | interformng.attachmentName | The name to use for the attachment in the email. |
MAILSERVER (Email server) | interformng.emailServerName | The name of the email server in InterFormNG2, that you want to use for the email. |
SUBJECT (Email subject) | email.subject | The subject of the outgoing email. |
MAILFROM (Email from) | email.from | The email address of the sender of the email. |
MAILTO (Email to) | email.to | The email address(es), that the email is to be sent to. |
MAILCC (Email CC) | email.cc | The email address(es), that should be CC receivers of the email |
MAILBCC (Email BCC) | email.bcc | The email address(es), that should be BCC receivers of the email |
MAILTEMPL (Email template) | interformng.emailTemplate | The email template, that configures the contents of the email. |
FILE1..FILE10 (F1..F10) | N/A | Optional input files, that will be attached to the email as extra file attachments in the email. The attachments are named: file_1 to file_10 unless you rename the attachment first with the rename attachment workflow component. You can also use these files for other things e.g. as dynamic images in the templates. |
Parameter on command | NG2 workflow variable | Description |
PRINTER (Printer name) | interform.destination.printer.printerName | Reference to a printer, that is registered in InterFormNG2. |
COPIES (Print copies) | interform.destination.printer.copies | The number of copies, that should be printed. |
Parameter on command | NG2 workflow variable | Description |
FILE1..FILE10 (F1..F10) | N/A | Optional input files, that will be attachments in the workflow The attachments are named: file_1 to file_10 unless you rename the attachment first with the rename attachment workflow component. You can also use these files for other things e.g. as dynamic images in the templates. |
interform.input.file.absolute.path | The full path to an input file, that InterFormNG2 should use. The contents of the file is binary inserted as the contents of the initial payload, when the linked workflow is processed. | |
OUTFILE (File name) | interform.plugin.archiver.fileName | The name of the output file. |
DIR (Directory) | interform.plugin.archiver.folderName | The path (without the file name) to where the output file is to be saved. |
CONFLICT (File conflict resolution) | interformng.output.conflictResolution | How to handle it, if the output file already exists. These values are accepted: Overwrite, Rename, AppendVersion, AppendTimestamp This affects only the files written in the workflow as selected above. More information. |
TOSTMF (To stream file) | N/A | Saves the payload, that the workflow returns as this file - independently of the workflow. Leave it blank, if nothing is returned or if the output e.g. is generated and save directly in the workflow. |