In InterForm400 you are always limited by the page breaks of the original *SCS spooled files. You never able to move information from one page to another or to change the height of the page making it possible to print more information on the final output. BUT with the Reformat finishing definition things have changed.
The reformat definition makes it possible to change the page breaks of an *SCS spooled file. It is intended for *SCS spooled files, that contains documents for different customers with detail lines. The reformat will create a new *SCS spooled file with new page numbers within each document, rearrange text for each detail line (and following text lines) and e.g. even call a user exit program to include advanced calculations for each new detail line.
In order to create a new Reformat finishing definition you select this from the InterForm400 Main Menu:
5. Work with Auto Forms Control
4. Finish Definitions
Press F6=Add
State a name and description and select type: '07 = Reformat Spooled File'.
Then you will see this screen:
Work with reformat definition RFM300D
Definition name . . . . . : DEMO_REFOR Description . . . . . . . : Reformat the Demo spooled file
Type option, Press Enter. 1=Select
Opt Definition _ Head _ User exit program _ Detail lines _ Totals _ Footer
F3=Exit F12=Cancel
|
Below each of the elements are described:
When you select this element the first screen will look like this:
Work with reformat definition RFM300D
Definition name . . . . . : DEMO_REFOR Description . . . . . . . : Reformat the Demo spooled file
Input head Number of lines . . . . . 10__ 1 - 200, *VAR
|
Here you can state how many of the first lines (including the blank lines) from the input spooled file, that are considered a part of the header i.e. that they are not detail lines. If you state e.g. 10, then all line 1-10 of the input spooled file is considered to be the header. If you specify *VAR this will part of the screen will change to this:
Work with reformat definition RFM300D
Definition name . . . . . : DEMO_REFOR Description . . . . . . . : Reformat the Demo spooled file
Input head Number of lines . . . . . *VAR
The last line of head is found as the first line, that has startposition ___ length __ = ________________________________________ or = ________________________________________ or = ________________________________________ or = ________________________________________ + 0 lines.
Output heads are to have __ lines.
|
On the screen above you tell InterForm400 how to detect the last line of the input header.
The number keyed in '+ _ lines' will be added to the line number where the condition above is met. So if the condition e.g. is found in line 5 and you have '3' in this place, then the first 8 lines are considered to be a header.
The number in 'Output heads are to have ___ lines.' tells InterForm400 the minimum number of lines for the output header. However the number of lines in the output header can never be lower than number of lines in the header of the input spooled file.
Press Enter and you will come to this screen:
Work with reformat definition RFM300D
Definition name . . . . . : DEMO_REFOR Description . . . . . . . : Reformat the Demo spooled file
Input head
Levelbreak is found in head
line __ startpos. ___ length __ and line __ startpos. ___ length __ and line __ startpos. ___ length __
Page number within level is to be printed in output line __ position ___
Line-id is to be printed in all output lines in output position ___
F3=Exit F12=Cancel
|
Each time there is a new customer InterForm400 will have to make a page break in the new spooled file. Above you state how InterForm400 can determine that. If the information found in the place pointed to by 'Levelbreak is found in head..' changes, then InterForm400 will do a level break. So here you should point to a place where a document reference number is found (e.g. invoice number).
Next you should state a place, where the page number within each new document is to be placed. Finally you can choose where to print the line-id of each detail line in the reformattet output. The line-id is identification of each line that can be useful for making conditions in the overlay that you merge with later on.
From the reformat finishing definition you can call a user exit program in order e.g. to extract certain information from the spooled file, transfer that to the program, where you e.g. calculate other values which then are placed back into the new spooled file.
When you select this option you will see a screen like this (if you press Enter a couple of times):
Work with reformat definition RFM300D
Definition name . . . . . : DEMO_REFOR Description . . . . . . . : Reformat the Demo spooled file
User exit program . . . . : __________ *NONE Library . . . . . . . . : __________ Name, *LIBL
Exit fields from 1st head in level to user exit program Field-1 linenbr __ position ___ length ___ Field-2 linenbr __ position ___ length ___ Field-3 linenbr __ position ___ length ___
Is user exit program to be called when processing 1st head in level . . . . . . . . . : ____ *NO, *YES
Placing of return fields in output head Field-1 linenbr __ position ___ Field-2 linenbr __ position ___ Field-3 linenbr __ position ___ F3=Exit F12=Cancel
|
On the top you can enter a user exit program. This program must be owned by QSECOFR (like all InterForm400 exit programs). On the middle of this screen you can specify if you want the reformat definition to call the program each time a new header is made or not. If you state *YES, then the up to 3 fields specified in the top of the screen will be transferred to the user exit program when called. The program can return up to 3 fields, that are placed as stated in the bottom of the screen above.
For an example of such a user exit program look in member RFMEXIT in source file APF3812/APISRC. This program must be owned by QSECOFR (like all user exit programs called by InterForm400).
Note, that the same program can be called when handling each detail line later. The parameter &CALLID will indicate if the program is called from a header or detail line.
WARNING: Do NOT place any programs or other objects in the APF3812 library as these objects will not be copied over to the new version in case of an upgrade of InterForm400.
Select this option and you will get to the screen below:
Work with reformat definition RFM300D
Definition name . . . . . : DEMO_REFOR Description . . . . . . . : Reformat the Demo spooled file
Number of detail lines per output page
1st page per level break . ____ Following pages . . . . . ____
Maximum number of blank lines between 2 detail lines . . __
F3=Exit F12=Cancel
|
You fill in the fields:
1st page per level break
This indicates how many detail lines, that there is room for on the first page for each document or customer (after a level break).
Following pages
The page header will be excluded from the second and following pages. That should make room for more detail lines. You type how many lines there are room for here.
Maximum number of blank lines between 2 detail lines
As a part of reformatting there might be some new blank lines within the detail lines. Here you can limit the number of the blank lines.
Press <Enter> and you will get a list of rule lines describing how the detail lines should be handled and build up. Type a new sequence number and press the <Field Exit> key to create a new line:
Work with reformat definition RFM300D
Definition name . . . . . : DEMO_REFOR Description . . . . . . . : Reformat the Demo spooled file
Reformating detail lines Rule 02 All non empty detail lines 01 All non empty detail lines
Rule Description 1.0 ______________________________ If position . . . . . . . . ___ 1-378 length . . . . . . . . . __ 1-30 compare type . . . . . . _ = > < N A U compare value . . . . . _______________________________ occurrence . . . . . . . ______ *ALL, *FIRST, *LAST Number of lines to handle . . . ____ 1-99, *VAR Action . . . . . . . . . . . . _________ *REFORMAT, *DELETE Line-ID code . . . . . . . . . ____ Call user exit program . . . . ____ *NO, *YES F3=Exit F11=Delete F12=Cancel
|
Here you first enter a condition to select only this specific type of detail line. This condition will only be considered for the lines after the header:
Position
The starting position of the text compare.
Length
The length of text to compare.
Compare type
The type of compare to do. Refer to here for an explanation.
Compare value
The text, that should be compared with.
Occurrence
States which of the lines (fitting the condition), that should be selected: *FIRST will be used only for the first time this line is found after a level break and *LAST will be used for the last time only that this line is found within a level break.
Number of lines to handle
Here you state how many detail lines, that should be 'taken' from the original spooled file if the condition is true. All the lines from the original spooled file will be available for reformatting when progressing. If you use *VAR this line will get all the detail lines of the original spooled file until this or another condition is true.
Action
Select *REFORMAT if you want the text of the input detail line(s) on the output spooled file as well. Use *DELETE if this line (or lines) should not be visible on the output spooled file.
Line-ID code
A code for this kind of detail line. This will be inserted on the output spooled file e.g. to be used for conditioning in the overlay design. The position where this is placed is decided as described here.
Call user exit program
Tells InterForm400 if the user exit program should be called for this detail line. If you activate this call this window will pop up:
Exit fields Detail exit field-1 Line __ position ___ length ___ Detail exit field-2 Line __ position ___ length ___ Detail exit field-3 Line __ position ___ length ___
Placing return fields Return field-1 Lineno. ____ position ___ Return field-2 Lineno. ____ position ___ Return field-3 Lineno. ____ position ___ F3=Exit F12=Cancel
|
Here you can specify the information, that you want to transfer from the spooled file onto the user program and where you want to place returned information. The line numbers are all relative to the line where the condition is met.
If you above have chosen *REFORMAT for the action to take you will see a list of lines describing how the output detail line(s) should look. You can insert 2 types of definition lines:
1 = Reformat input:
Seqnbr. Type Input line position length Output line position 1.0 1 __ ___ ___ __ ___
|
2 = Text constant:
Seqnbr. Type Text constant Output line position 2.0 2 ________________________________ __ ___
|
With these 2 types of lines you can decide how the input detail line(s) should be presented in the output spooled file.
WARNING: Plan how you want to structure the sequence of these lines as there is no tool for resequencing.
When you select this option you are asked if the print out has totals. If you answer *NO, then it is assumed, that the original spooled file has no totals and that no totals should be inserted in the new reformatted spooled file. Below is described what to go through if you select *YES.
The first screen looks like this:
Work with reformat definition RFM300D
Definition name . . . . . : DEMO_REFOR Description . . . . . . . : Reformat the Demo spooled file
Localization of totals total lines starts . . . . __ 0 - 99 lines before the last occurrence of the text . . . . . . . ______________________________ or . . . . . . . . . ______________________________ or . . . . . . . . . ______________________________ or . . . . . . . . . ______________________________ in position . . . . . . . ____ length . . . . . . . . . . ___
F3=Exit F12=Cancel
|
InterForm400 will search for any of the texts you type in. You can tell how many lines before the 'hit', that should be considered to be a part of the total. If e.g. you search for the text 'Total' and there is a '***********' line just above this line, then you should enter '1' in 'total lines starts __ lines before the last occurrence'.
Press Enter to proceed to the screen below:
Work with reformat definition RFM300D
Definition name . . . . . : DEMO_REFOR Description . . . . . . . : Reformat the Demo spooled file
Placing of totals
Select one of the following options:
1. Just after the last detail line 2. Like 1, if there is space for all total lines, otherwise next page. 3. In foot
Option _
F3=Exit F12=Cancel
|
On this screen you can decide how the total should be inserted:
1. Just after the last detail line
This choice will insert the totals just after the last detail line. If there is no room for all lines for the total, then the rest is inserted on the next page.
2. Like 1, if there is space for all total lines, otherwise next page.
This works like a 'block protect'. Transfers all the total lines onto the next page if necessary.
3. In foot
Prints the totals in the footer.
Press Enter to proceed to this screen:
Work with reformat definition RFM300D
Definition name . . . . . : DEMO_REFOR Description . . . . . . . : Reformat the Demo spooled file
Extra total page
Extra total page is created, if number of output detail lines on the last page is above a certain limit
Limit detail lines if last page is page 1 . . . . __0 Limit detail lines if last page is >1 . . . . . . __0
Total line-ID If only 1 total page . . . . . . ____ If 2 total pages, first total . . ____ If 2 total pages, extra total . . ____
F3=Exit F12=Cancel
|
The header may be larger on page 1 for each document, so there might room for fewer detail lines on the first page than on the subsequent pages. You state here the number of detail lines that there are room for.
You can also state various line-ID's depending on if the total is spread across two pages or not:
If only 1 total page
This denotes the line-ID to be inserted if the total is not spread across 2 pages.
If 2 total pages, first total
The specifies the line-ID for the part of the total lines, that are placed on the page before the last - if the total lines are split across pages.
If 2 total pages, extra total
States what line-ID to insert for the part of the total lines, that is placed on the last page - if the total lines are split across pages.
When you press Enter you will proceed to this screen:
Work with reformat definition RFM300D
Definition name . . . . . : DEMO_REFOR Description . . . . . . . : Reformat the Demo spooled file
Reformating totals
0001 1 01 050 060 1 50 0002 2 Total 1 40
Seqnbr. Type 2.0 _ 1 = Reformat input 2 = Text constant
F3=Exit F11=Delete F12=Cancel
|
Here you can edit and rearrange the total lines in the output spooled file. This works exactly as for the detail lines.
Here you key in the placement of the footer i.e. in which line number it starts in the original spooled file and how many of the footer lines, that you want to include in the new reformatted spooled file.
NOTE: The footer lines will in the output spooled file be placed between the header and the detail lines.
When you have defined your reformat finishing definition you go to Auto Forms Control and insert a function 'C = Prepare for Finishing' for the relevant output queue.