Programmers can create a changed version of an existing SCS spooled file by using the InterForm400 PageBuilder feature.
The Page Builder feature is invoked by entering the Create PageBuilder Spooled File command (APF3812/CRTPBSPLF).
Prior to using the PageBuilder feature, a PageBuilder program must be created. This program must be specified for the PAGBLDPGM parameter on the CRTPBSPLF command.
Create PageBuilder Spooled File (CRTPBSPLF)
Type choices, press Enter.
PageBuilder program . . . . . . PAGBLDPGM __________ Name Library . . . . . . . . . . . __________ Name Data parameter definition: DTAPARM _ Find 'string' . . . . . . . . __________ Value, *PAGE, *ANY String length . . . . . . . . *STR__ 1-256, *STR Return length . . . . . . . . *STRLEN 1-256, *STRLEN Minimum line . . . . . . . . . ______ 1-255 Maximum line . . . . . . . . . ______ 1-255 Minimum starting position . . ______ 1-378 Maximum starting position . . ______ 1-378 + for more values _ Spooled file . . . . . . . . . . FILE __________ Name Job name . . . . . . . . . . . . JOB *_________ Name, * User . . . . . . . . . . . . . __________ Name Number . . . . . . . . . . . . ______ 000000-999999 Spooled file number . . . . . . SPLNBR *LAST_ 1-9999,*ONLY,*LAST Application ID parameter . . . . APPIDPARM _______________________________ _______________________________________________ Output queue . . . . . . . . . . OUTQ *INPUT____ Name, *INPUT Library . . . . . . . . . . . __________ Name, *LIBL Form type . . . . . . . . . . . FORMTYPE *INPUT____ Character value Output spooled file name . . . . SPLFNAME *INPUT____ Name, *INPUT
F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
Create PageBuild Spooled File (CRTPBSPLF)
Type choices, press Enter.
Page size: PAGESIZE Length . . . . . . . . . . . . *INPUT 1-255, *INPUT Width . . . . . . . . . . . . *INPUT 1-378, *INPUT
Bottom F3=Exit F4=Prompt F5=Refresh F12=Cancel F13=How to use this display F24=More keys
|
•First the CRTPBSPLF command calls the PageBuilder program (specified by the PAGBLDPGM keyword) with parameter 1 = ‘STR’.
•Then the CRTPBSPLF command reads all pages from the input spooled file specified by the FILE, JOB and SPLNBR keywords.
•For every page in the spooled file the PageBuilder program is called having parameter 1 = ‘PAG’ and parameter DATA01-DATA10 equal to the data found on the active page according to the values for the DTAPARM keyword - unless you use *PAGE then the contents of the current page is transferred in an array 378 char wide by 255.
•The PageBuilder program now updates parameters (DATA01-DATA10) according to program logic - or the array if you use *PAGE.
•The CRTPBSPLF command creates a new page in a new SCS spooled file with the updated values (DATA01-DATA10).
•After processing all pages your PageBuilder program is called once more having parameter 1=’END’
The parameters of the command are these:
PAGBLDPGM
The PageBuilder program that the command is to call for each page.
DTAPARM
Use this to define each of parameters DATA01-DATA10. Insert a '+' in the first or last line to insert and define another DATA field. Each of the DATA fields are defined like this:
Find 'string':
Type in e.g. *PAGE to transfer the contents of whole spooled file page to the page builder program without the use of DATA01-DATA10. Use of *ANY tells that you do not want to search after any specific text. Other values are interpreted as a string to search for in each spooled file page.
NOTE: If you use *PAGE for Find string, the rest of the fields for DTAPARM are ignored.
String length:
The length of the string to search for/compare with in 'Find string'. Use of *STR indicates that you want to use the length of the that string.
Return length:
The number of characters to insert in the spooled file from the DATAxx, that is returned from the page builder program.
Minimum/maximum line:
The interval of lines in the spooled file to search for the string. If you know what line you want to use just specify this for both.
Minimum/maximum starting position:
The interval of positions to search in the spooled file for the 'Find string'.
Pass data from position:
You can pass some spooled file data from the line where the string of text is found onto the page builder program (in DATAxx). Here you state the starting position of this text. Use *STRPOS to use the position where 'Find string' text is found.
Pass data length:
Works like the previous field. This just determines the length of
the spooled file data to move to the page builder program.
FILE
Spooled file name of the *SCS spooled file to operate on.
JOB
Job name, user profile and job number of the input spooled file.
SPLNBR
Input spooled file number.
APPIDPARM
Application ID parameter. This is transfered onto the page builder program as a parameter. This can be useful if you e.g. want to call the same pagebuilder program from different uses of the CRTPBSPLF command.
OUTQ
The output queue where the new and changed spooled file will be created. *INPUT will make the command create the new spooled file on the same output queue as the original spooled file.
FORMTYPE
The formtype of the new, changed spooled file.
SPLFNAME
The name of the new spooled file.
PAGESIZE
The size (height and length) of the new spooled file created by the command. The default values, *INPUT will use the number of lines and positions from the input spooled file. If you need more space e.g. for new texts, then you can use this to extend the size.
Example:
CRTPBSPLF PAGBLDPGM(LIB1/BPSAMP)DTAPARM((‘INVOICE NO’ 10 10 1 80 51 51) (*ANY 9 9 11 11 12 12))
FILE(QSYSPRT) JOB(*) SPLNBR(*LAST) APPIDPARM(‘MY ID’) OUTQ(DIAG)
This will process the last QSYSPRT spooled file for the current job, calling the program BPSAMP in library LIB1 for every page in this spooled file.
Keyword DTAPARM describes where to find the values for parameters DATA01-DATA10 (see PageBuilder program parameters below) which are passed to program BPSAMP.
(‘INVOICE NO’ 10 10 1 80 51 51) = specification of DATA01.
Value will be ‘INVOICE NO’ (or blank if not found in line 1-80 position 51).
Length = 10 characters.
Length = 10 characters, when returned from the program BPSAMP,
(*ANY 9 9 11 11 12 12) = specification of DATA02.
*ANY indicate whatever found (in line 11 position 12).
Pass 9 characters to program BPSAMP
Return 9 characters from program BPSAMP.
NOTE: The DATA01-DATA10 parameters can be used for searching for a specific text in the spooled file. Note however that they return/find only the FIRST occurrence on the page.
PageBuilder program parameters
Parameter # |
Length |
Usage |
Description |
1 |
3 |
I |
CRTPBSPLF call option STR, PAG or END |
2 |
64 |
I |
Value from the APPIDPARM keyword |
3 |
256 |
I/O |
DATA01 (input from spool file - DTAPARM) |
4 |
256 |
I/O |
DATA02 (input from spool file - DTAPARM) |
.... |
256 |
I/O |
DATAxx (input from spool file - DTAPARM) |
12 |
256 |
I/O |
DATA10 (input from spool file - DTAPARM) |
For example of sources for a Page Builder Program see member PAGBLDPGM and PAGBLDPGM2 in source file APF3812/APISRC. PAGBLDPGM2 illustrates how to use the *PAGE option.
The *PAGE option is normally the easiest to implement.