This section covers the IFORMNG2/NG2CMD command on the IBM i platform. In order to run this command or the IFORMNG2/NG2CPDFEML command you first need to ensure, that the prerequisites are met.
The NG2CMD command is the most generic command, where the command NG2CPDFEML 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 NG2CMD command looks like the screens below.
The parameters are explained here.
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
|
... PARM5 to PARM29 are not displayed here.
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
|
A few examples of how you can use the command is included in the sections below:
1.Command call: Dump the variables. This can be used, if you want to debug a command call.
2.Command call: Email. Shows how you can merge a spooled file into a PDF and email as an attachment via a command call.
3.Command call: Email with extra attachment. How you can add an extra attachment and set the extra attachment name.
4.Command call: Create PDF from payload. Create a PDF in the payload and save it to the IFS in the called command.
5.Command call: Create PDF in workflow. Create a PDF in the workflow from a command.
6.Command call: Merge XML into PDF. Merge an input XML file with a template and save the result as a PDF file.
7.Command call: Print. Merge a spooled file with a template and print it via a command on an IBM i.
Here are some potential issues with a description of how they can be solved:
1.TOOLSSERVER must be running in subsystem IFORMNG2 (C R)
2.
3.
TOOLSSERVER must be running in subsystem IFORMNG2 (C R)
If you see this error message, when you call the command, IFORMNG2/NG2CMD, then you should ensure, that the TOOLSHED2 jobs are running in the IFORMNG2 subsystem. You can e.g. see that via the command WRKACTJOB SBS(IFORMNG2) or via IFORMNG2/IFORMNG2 followed by option:12. Work with IFORMNG2 subsystem.
Then you should see this:
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
|
Please notice the TOOLSHED2 jobs. They need to be active and not stopped with the status MSGW.
If they are not running, then you need to ensure that they should run at the next restart of the IFORMNG2/IFORMNG2 subsystem. You need to verify the settings on the IFORMNG2/IFORMNG2 command/menu. You will see these options:
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
|
Now select option 92. NG2 installation and configuration and then you should seem something like below:
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 important setting is, that the option CommandLine to NG2 is *ACTIVE. If it is not, then you need to change the value to *ACTIVE and then restart the IFORMNG2/IFORMNG2 subsystem e.g. via option 11 and 10 on the menu above.