InterForm400 provides a wide range of extra commands and tool that can help you and your end users in your daily work. To see in what areas InterForm400 can help you it is a very good idea to go through the list of commands provided in InterForm400.
Below a few tips are listed:
The normal WRKOUTQ command is fine, but it has a few limitations when working with InterForm400. It can e.g. not display a merged spooled file. That is one of the reasons why InterForm400 is delivered with the alternative command: APF3812/APFWRKOUTQ.
The advantages of the APFWRKOUTQ command are:
•You can see how many pages a merged spooled file is.
•You can change the page range of a merged spooled file if you used a PJL printer. type for the merge in InterForm400.
•You can display merged spooled files via Swiftview.
•You can e-mail merged spooled files directly from the menu via option 1. (The senders e-mail address is grabbed from the SMTP information of the current user in the system directory and the overlay or overlay selector is found in the afc setup of the outq).
Please also notice, that InterForm400 contains an alternative to the WRKSPLF command, called APFWRKSPLF.
One way to use the advantages of this command can be to create a new library and create a duplicate of the APFWRKOUTQ command in it:
CRTLIB APFWRKOUTQ
CRTDUPOBJ OBJ(APFWRKOUTQ) FROMLIB(APF3812) OBJTYPE(*CMD) TOLIB(APFWRKOUTQ) NEWOBJ(WRKOUTQ)
This WRKOUTQ command will temporarily not work during an upgrade of InterForm400 or if the apf3812 library does not exist. To avoid a problem you could remove or rename the extra WRKOUTQ command created above during an upgrade of InterForm400 or if you decide to remove InterForm400 - but why would you do that? ;-)
The commands: APF3812/APF3812 and APF3812/MRGSPLFPDF can merge a spooled file with an overlay or overlay selector and present the result directly on the screen if you are running the commands in an interactive job.
If you e.g. have just created a screen shot in the same job, then you can refer to the last spooled file generated with the right spooled file name. To view such a spooled file directly you could build in either of these commands into your user menues:
APF3812/APF3812 KARTSET(myfilset) KLICHE(overlay) FILNVN(QPRINT) SPLNBR(*LAST) PRTTYP(HP4) OUTPUT(*VIEWER)
APF3812/MRGSPLFPDF KARTSET(myfileset) KLICHE(overlay) FILNVN(QPRINT) SPLNBR(*LAST) OUTTYPE(*VIEW)
Above we assume that the spooled file just generated is called QPRINT. We are using an overlay for the merge, but we could of course also have used an overlay selector.
InterForm400 can help you to add dynamic functions to your existing applications for which you do not even have the source code..
You can tell InterForm400 to inspect the contents of a 5250 screen and decide what to do depending on what is found. Then InterForm400 can also pick out information e.g. found in the line of the cursor, and use that as parameters in a function or command.
To do this you first define what functions you want to execute and when they should be activated. You define that via the command: APF3812/WRKSCNDFN:
Work with screen definitions SCR100D
Position to . . . . . . __________ Screen definition Required library . . __________
Type options, press Enter. 2=Change 3=Copy 4=Delete 5=Display
Opt Screen Req.lib Description _ COPY_SPLF *NONE Copy spooled file via SNDTCPSPLF from APFWRKOUTQ _ WRKACTJOB *NONE View Joblog as PDF from WRKACTJOB _ APFMENU APF3812 Enter InterForm400 from Main if APF3812 is in LIBL
End F3=Exit F5=Refresh F6=Create F11=View 2 F12=Cancel
|
If you press F6=Create you can add a new screen definition:
Create screen definition SCR110D
Screen definition . . . : APFMENU Required library . . . : APF3812
Description . . . . . . . Enter InterForm400 from Main if APF3812 is in LIBL
Type comparisons, press Enter. Specify OR to start each new group. Leave line and/or position blank to select cursor line/position.
AND/OR Line Pos. Opr. Compare value 1 33 EQ OS/400 Main Menu ___ ___ ___ __ _____________________________________________________ ___ ___ ___ __ _____________________________________________________ ___ ___ ___ __ _____________________________________________________ ___ ___ ___ __ _____________________________________________________ ___ ___ ___ __ _____________________________________________________ ___ ___ ___ __ _____________________________________________________ ___ ___ ___ __ _____________________________________________________ ___ ___ ___ __ _____________________________________________________ More... F3=Exit F12=Cancel
|
Above we have defined:
Required library is APF3812. This means that this function will ONLY be considered if the APF3812 library is in the library list of the current job when <Escape> is pressed.
The compare value is ‘OS/400 Main Menu’. This means, that this function will be run ONLY if we press the <Escape> key when we are on the OS/400 Main Menu (This text must be found on the screen in line 1 starting in position 33).
We press <Page Down> to see this screen:
Create screen definition SCR110D
Screen definition . . . : APFMENU Required library . . . : APF3812
Command . . . . . . . . . APF3812/APFMENU KARTSET(&A)
Leave line and/or position blank to select cursor line/position.
Line Pos. Len Description &A 20 7 10 File set &B &C &D &E &F &G &H &I End F3=Exit F4=Prompt F12=Cancel
|
Here we can take various information from the current screen and use it as parameters for a command. Above we take the text found in line 20 from position 7 (10 characters from this position) and use that as a parameter for the APF3812/APFMENU command in the file set parameter (KARTSET). This means that if you type a file set before you press <Escape> then this file set will be used when you enter InterForm400 with this command.
If we leave out the line and/or position above then the position of the cursor is used (when Escape was pressed).
Simular you can define that you want to view a joblog as a PDF file via this setup:
Change screen definition SCR110D
Screen definition . . . : WRKACTJOB Required library . . . : *NONE
Description . . . . . . . View Joblog as PDF from WRKACTJOB
Type comparisons, press Enter. Specify OR to start each new group. Leave line and/or position blank to select cursor line/position.
AND/OR Line Pos. Opr. Compare value 1 30 EQ Work with Active Jobs
More... F3=Exit F12=Cancel
|
Change screen definition SCR110D
Screen definition . . . : WRKACTJOB Required library . . . : *NONE
Command . . . . . . . . . CALL PGM(KSE/JOBLOGPDF) PARM(&A &B &C)
Leave line and/or position blank to select cursor line/position.
Line Pos. Len Description &A 9 10 JobName &B 22 10 User &C 34 6 JobNbr &D &E &F &G &H &I End F3=Exit F4=Prompt F12=Cancel
|
The line numbers in the screen above are not filled out. So this means that the information is found in whatever line the cursor is in. Please note that the function requires that you first press F11 twice on WRKACTJOB so you can see the jobname, user and Job number like below:
Work with Active Jobs INTER03 10/02/09 15:21:42 CPU %: .0 Elapsed time: 00:00:00 Active jobs: 170 Opt Subsystem/Job User Number Type CPU % Threads AUTO_FORM2 QSYS 221717 SBS .0 1 AFC_INPUT2 AFCOPER 221724 BCH .0 1 AMG2 AFCOPER 221725 BCH .0 1 DEMOIDX AFCOPER 221743 BCH .0 1 IN_OUTQ04R AFCOPER 221726 BCH .0 1 INFOR_TEST AFCOPER 221727 BCH .0 1 INFORUM AFCOPER 221728 BCH .0 1 LIFVOSS_IF AFCOPER 221729 BCH .0 1 MU_PRTWT9I AFCOPER 221730 BCH .0 1 PRT_APF25I AFCOPER 221731 BCH .0 1 PRT_ZTESTI AFCOPER 221732 BCH .0 1 USER2 AFCOPER 221733 BCH .0 1 USER2QUSRS AFCOPER 221734 BCH .0 1 WOLFTEST AFCOPER 221735 BCH .0 1 ZEBRA_KSE AFCOPER 221736 BCH .0 1 ZZZZZZZZZZ AFCOPER 221752 BCH .0 1 More... ===> F21=Display instructions/keys
|
The source of the called program could be this:
/*-------------------------------------------------------------------*/ /* This is an example of a program, that can be called from */ /* the APF3812/WRKSCNDFN command in InterForm400. */ /* */ /* This program is to display the joblog of a job marked out in */ /* WRKACTJOB. It will merge and display the joblog as a PDF file. */ /* */ /* */ /*-------------------------------------------------------------------*/
PGM (&JOBNAME &USER &JOBNBR)
DCL &ALL *CHAR 31 DCL &JOBNAME *CHAR 10 DCL &USER *CHAR 10 DCL &FILE *CHAR 40 DCL &JOBNBRA *CHAR 6 DCL &JOBNBR12 *CHAR 12 DCL VAR(&JOBNBR) TYPE(*DEC) LEN(15 5)
/* Convert the numeric jobnumber into 6 characters */ CHGVAR VAR(&JOBNBR12) VALUE(&JOBNBR) CHGVAR VAR(&JOBNBRA) VALUE(%SST(&JOBNBR12 1 6))
/* First make sure that the joblog is not printed out. */ OVRPRTF FILE(QPJOBLOG) OUTQ(APF3812/AFC_INPUT1) + HOLD(*YES)
/* Now generate the joblog as a spooled file: */ DSPJOBLOG JOB(&JOBNBRA/&USER/&JOBNAME) OUTPUT(*PRINT) MONMSG MSGID(CPF0000) EXEC(DO) SNDUSRMSG MSG('The job does not exist or is no longer + active.') MSGTYPE(*INFO) GOTO END ENDDO
/* Now merge the spooled file and view it: */ APF3812/MRGSPLFPDF KARTSET(MYFILESET) KLICHE(MYOVL) + FILNVN(QPJOBLOG) SPLNBR(*LAST) + OUTTYPE(*VIEW)
/* Delete the temporary spooled file */ DLTSPLF FILE(QPJOBLOG) SPLNBR(*LAST)
END: ENDPGM
|
We want also to add a new function to the APFWRKOUTQ command via the <Escape> key. This is only to be run if we press <Escape> on the APFWRKOUTQ screen:
Change screen definition SCR110D
Screen definition . . . : COPY_SPLF Required library . . . : *NONE
Description . . . . . . . Copy spooled file via SNDTCPSPLF from APFWRKOUTQ
Type comparisons, press Enter. Specify OR to start each new group. Leave line and/or position blank to select cursor line/position.
AND/OR Line Pos. Opr. Compare value 1 72 EQ APFOUTQD
More... F3=Exit F12=Cancel
|
If we press <Escape> we want to copy the spooled file in the line where the cursor is placed (the lines are not filled out). It is defined as below (seen by pressing <Page Down>):
Change screen definition SCR110D
Screen definition . . . : COPY_SPLF Required library . . . : *NONE
Command . . . . . . . . . CALL PGM(KSE/COPY_SPLF) PARM(‘&A’ ‘&B’ ‘&C’ ‘&D’ ‘&E)’
Leave line and/or position blank to select cursor line/position.
Line Pos. Len Description &A 8 10 Spooled file name &B 28 10 Job name &C 40 10 User &D 52 6 Job number &E 20 6 Spooled file number &F &G &H &I End F3=Exit F4=Prompt F12=Cancel
|
Also notice that the function will only work if the information above is visible on the screen so you need to press <F11> before you press <Escape>.
The source of the called program is this:
/*-------------------------------------------------------------------*/ /* This is an example of a program, that can be called from */ /* the APF3812/WRKSCNDFN command in InterForm400. */ /* */ /* This program is to copy a spooled file to the default outq of */ /* the current job. */ /* */ /* */ /*-------------------------------------------------------------------*/
PGM (&SPLFNAME &JOBNAME &USER &JOBNBR &SPLFNBR)
DCL &SPLFNAME *CHAR 10 DCL &JOBNAME *CHAR 10 DCL &USER *CHAR 10 DCL &FILE *CHAR 40 DCL &JOBNBRA *CHAR 6 DCL &JOBNBR12 *CHAR 12 DCL &JOBNBR *DEC LEN(15 5) DCL &SPLFNBR *DEC LEN(15 5) DCL &SPLFNBRA *CHAR 6 DCL &SPLFNBR12 *CHAR 12 DCL &OUTQ *CHAR 10
/* Convert the numeric job number of the spooled file into 6 char: */ CHGVAR VAR(&JOBNBR12) VALUE(&JOBNBR) CHGVAR VAR(&JOBNBRA) VALUE(%SST(&JOBNBR12 1 6))
/* Convert the numeric splf number of the spooled file into 6 char: */ CHGVAR VAR(&SPLFNBR12) VALUE(&SPLFNBR) CHGVAR VAR(&SPLFNBRA) VALUE(%SST(&SPLFNBR12 1 6))
/* Get the outq of the current job: */ RTVJOBA OUTQ(&OUTQ)
/* Send or copy the spooled file: */ SNDTCPSPLF RMTSYS(*INTNETADR) PRTQ(&OUTQ) + FILE(&SPLFNAME) + JOB(&JOBNBRA/&USER/&JOBNAME) + SPLNBR(&SPLFNBRA) DESTTYP(*AS400) + TRANSFORM(*NO) MFRTYPMDL(*NONE) + INTNETADR('127.0.0.1')
SNDUSRMSG MSG('The spooled file has been copied.') + MSGTYPE(*INFO)
END: ENDPGM
|
Now we are done setting up the functions and we only need to activate these functions on the relevant jobs. In order to do that you just need to make sure that the jobs run the command: APF3812/STRSCNATN:
Start Screen Attention (STRSCNATN)
Type choices, press Enter.
Command . . . . . . . . . . . . CMD > GO MENU(MAIN)
Default program . . . . . . . . DFTPGM *USRPRF Name,*USRPRF,*ASSIST,*NONE Library . . . . . . . . . . . Name, *LIBL, *CURLIB
Bottom F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
The command (CMD) is the command that will be run when this command is done. The default program is the program that will be run if no screen definition setup via WRKSCNDFN fits the current screen when someone is pressing <Attention> (or <Escape>).
Notice that the function above only works on the call level from where the STRSCNATN was run so you could e.g. run this in the initial program of the user profiles - just remember to do a MONMSG after the command so the users can sign on - even during an upgrade of InterForm400...