With this function you can call a program, which will get the identification of the input spooled file. This program can e.g. use the many commands in InterForm400.
8=Call Program
Seqnbr Function 1,0 8 Program call
Program name . . . . . . . . . . FUNKT_8 Library . . . . . . . . . . . MYLIB User profile . . . . . . . . . . AFCOPER *OWNER, user profile Parameter format . . . . . . . . 1 1, 2
F3=Exit F13=Fold/Unfold F11=Delete F12=Cancel
|
This function gives you the possibility of letting Auto Forms Control perform operations, that are not included in the standard AFC functions mentioned here. It could for instance be to store spooled print in a spool archive. Other useful features is to make a merge using the APF3812 CL command in order to create a PCL file in the folder system, or even E-mail the merged file as a PDF file using the MRGSPLFPDF command.
Program name
A program to be called at this point
The program can be called with two different parameter formats:
Parameter format 1:
The program can be called with the following 7 parameters regarding the relevant spool entry:
Job name |
*CHAR 10 |
User |
*CHAR 10 |
Job number |
*CHAR 6 |
File name |
*CHAR 10 |
File number |
*CHAR 6 |
Output queue |
*CHAR 10 |
Library |
*CHAR 10 |
An example of an exit program can be seen in the source member, FUNKT_8 in source file APF3812/APISRC.
Parameter format 2:
SPLA0100 |
*CHAR 1537 |
SPLA0100 is a data structure use e.g. by the QUSRSPLA API. The data structure and a complete example of such a program can be found in source member, FUNKT_8_2 in source file APF3812/APISRC. The data structure includes as good as any information of the spooled file.
Format 2 is recommended and needed, if you want to handle identical spooled files, that only differ in the identification when you look at the system that created the spooled file or the creation date and time.
If you have multiple identical spooled files, and you use format 1, then you will get this error message in the Auto Forms Control job:
Message ID . . . . . . : APF5050 Severity . . . . . . . : 00 Message type . . . . . : Inquiry
Message . . . . : Another spooled file with identical job and spooled file number exists. (C R I) Cause . . . . . : Unable to use parameter format 1 for the PRSCOPY program when another spooled file with identical job and spooled file number exists. Possible choices for replying to message . . . . . . . . . . . . . . . : C -- End AFC job for this output queue in error. R -- Retry (after the duplicate spooled file has been deleted manually). I -- Skip this step to create the duplicate spooled file.
|
User profile
The user profile under which the user exit program will run.
If e.g. a merge is done by use of the APF3812/APF3812 command the same user profile will be the owner of the merged spooled file.
InterForm400 will not call the program unless it is owned by QSECOFR. If the program is not owned by QSECOFR when you add it you will be offered an possibility to change the owner (if you are authorized) with this window:
Security change required OWN600D
In order to prevent unauthorized programs from being used as exit programs, the exit program must be owned by QSECOFR.
Press F10 to change the ownership of the program to QSECOFR. Press F3 or F12 to cancel.
Program name . . . . . : TEST Library . . . . . . : KSE
Creation date/time . . : 24/01/11 18:00:45 Current owner . . . . : KSE
F3=Exit F10=Change owner F12=Cancel
|
Here you can simply press F10=Change owner to confirm that the program owner should be changed. The same screen is shown in InterForm400, whenever you try to add a call to a user program not owned by QSECOFR. (Also for e.g. split exit programs)
The demo source for FUNKT_8 calls the demo program, GETSPLFA02, which retrieves the user data field (USRDTA) and the user defined data field (USRDFNDTA) of the input spooled file. The demo source of GETSPLFA02 is found in source file APF3812/APISRC, and can be changed to include other spooled file attributes. The demo source of SPLEXIT03 includes a complete description of the SPLA0100 structure, which you will need for that.
NOTE: All exit programs called by InterForm400® must be owned by QSECOFR. If it is not the AFC job will halt with an error message. Change the owner with the command: CHGOBJOWN OBJ(library/program) OBJTYPE(*PGM) NEWOWN(QSECOFR)
TIP: In order to be able to change the owner of a program into QSECOFR, it is enough to have *ADD authority for the QSECOFR user profile. You can give a user profile this via this command: GRTOBJAUT OBJ(QSECOFR) OBJTYPE(*USRPRF) USER(user profile) AUT(*ADD). Notice however that if the program is adopting the authority from the owner, then *ALLOBJ and *SECADM is required in order to change the object owner.