Please enable JavaScript to view this site.

Navigation: Technical Information > Cobwebb Exit Programs

Using the Advanced Reformatting Utility

Scroll Prev Top Next More

The Advanced Reformatting Utility allows you to totally control the format of your output document via the ADVRFMT [Cobwebb Standard] Exit Program; for example you may:

Define the number of detail lines that are output on a page.

Merge information from different pages onto one page - from v1.8

Change the sequence of the data you output

Include whole lines of external information

Displaying total number of pages e.g. Page 1 of 3

Store information from one page of the spool file to include later in the document.

Prevent a page break after a specific line of data

Force a page break before a specific line of data

Choose to print a heading of the Detail Key information on change in Detail Key field value and to output a blank line before / after or both

Wrap and Store text to be output

Summarise & Total information

Write multiple Detail lines using a bespoke Exit Program to write to the Advanced Reformatting Utility - see How to write Detail lines using an Exit Program.

From version 6.2.83 - For Infor customers who have the Style Module there is ADVRSTYLE to help with the formatting of Size / Quantity information.

When using the Advanced Reformatting Utility you would normally create two PPD files:

1.The Build PPD - to pass information from the original spooled file, and any other external information you wish to include in your output, to the Advanced Reformatting Utility. This will create a brand new spooled file to include all of the information you have defined so there is no need to specify an Output Device or anything in the Output pane in this PPD. You will need to decide if your output needs to be:

a.Portrait (up to 132 characters) or Landscape (up to 264 characters) - use the Mandatory *FIRST Call Type which would normally be inside a PAGE EQ *START Conditional element in your design.

b.Sorted at Header level e.g. Customer Number - use the *KEY Call Type which would normally be inside a PAGE EQ *FIRST Conditional element in your design.

c.Sorted at Detail line level e.g. Item Lines - use the Detail Key Fields in the *DET Call Type.

You will then need to work out what information you wish to be included in the Header i.e. the same for each page of a document e.g. Invoice Header details, and what you want included as Detail lines e.g. Invoice Lines. These are specified using the *HDR and *DET Call Types respectively. Note: You must have at least one *DET Call Type in your PPD.

Finally you need to add the Mandatory Call Type of *LAST which is when the new spooled file is generated; this would normally be inside a PAGE EQ *END Conditional element in your design. You can also override the Output Queue and User Data at this point if you wish.

There are various other Call Types that may be used and they are all outlined below in How it works in the Cobwebb Designer.

2.The Final PPD - to format the generated spooled file from the Advanced Reformatting Utility direct to your required Output Device types. The generated spool file will have the file name of either ADVPRTP (Portrait) or ADVPRTL (Landscape).

How it works in the Cobwebb Designer

Note: You may also wish to see the Flow Diagram for an overall view.

1.First we need to define the call the ADVRFMT program with *FIRST in PARM6 to provide the initial setup information such as desired lines per page to print, where you wish trailer/footer lines to start to printing and also whether the spooled file is *WIDE = 264 columns wide (double width needed) or normal width (up to 132 columns wide). This is a Mandatory call and should only occur once per spooled file.

2.From version 1.8 - there is an Optional *CONFIG call allowing you to specify other configuration details to be used when processing your PPD file; such as merging spooled file data from pages with the same *KEY details but where the pages may not be consecutive.

3.The next call of the ADVRFMT program is Optional and can be used to pass in Header Key field information either constant or from the source spooled file page, with *KEY passed into PARM6. This is used for sorting the output pages.

4.Header lines are Optional and are only stored once for a document (or when *KEY field information changes) but are passed in and the exit program is called on every page. Header lines will be printed at the top of every page of output for the document. Call ADVRFMT with PARM6 = *HDR repeatedly with PARMS 1-5 being used to enter 5 lines of header lines at a time from the source spooled file. Each time you call ADVRFMT with PARM6 = *HDR, pass in the next 5 lines of header text in PARMS 1-5. Note: If you want to output Header information AFTER Detail lines then you will need to pass *HDRX (extra) in PARM6 - (Advanced Reformatting Utility v1.4 or greater).

5.For Detail lines in the loop, call ADVRFMT with PARM6 = *DET (detail lines). Each detail item line will be passed using PARM1 (only) for 132 wide lines or PARM1 and PARM2 on the same line for 264 char wide lines. PARM5 can be set to *NO to “not allow a page throw after the line being copied”. This means if PARM5 = *NO, the next line copied will be kept onto the same page with no page throw allowed. Please note, PARM5 only states "Allow a page throw?" but pages will not be thrown unless the max number of lines per page is reached and PARM5 is not *NO. It is used only to prevent throwing a page for a few lines which need to be kept together on the same page. If you wish to re-sequence your detail lines then you may use either one or both of the key fields (PARM3 & PARM4) to supply the key sequence otherwise the order of the detail lines will remain as on the input spooled file. This is a Mandatory call and you should have at least one Detail line in your output.

6.On the last page for a document you can output Optional Trailer lines by calling ADVRFMT with PARM6 = *TRL. PARMS 1-5 should then contain the footer text which will only be printed on the last page of the output.

7.If you wish to store some text from the spool file to print at a later point in the output then you may call ADVRFMT using the *STORE and *WRITE calls to store and write the text respectively. You may specify a Line_ID for the stored text so that the number of stored lines is limitless. When you write the text you can choose whether to write it as a Detail, Header or Trailer line. There is also a *CLEAR call to clear any stored text by Line_ID.

8.You can also choose to wrap the stored text. This is done using the *WRAP and *WRITE calls in ADVRFMT to wrap and write the text respectively.  You may specify a Line_ID for the stored text so that the number of stored lines is limitless. When you write the text you can choose whether to write it as a Detail, Header or Trailer line.

9.If you wish to summarise information, with up to two values to be totalled, then you may use the *SUMIN and *SUMOUT calls in ADVRFMT to store and write out the summary information. You may specify a Summary_ID for a set of summary lines. When you output the summary you can choose whether to write it as a Detail, Header or Trailer line. This could be useful if you had say an item number appearing more than once and you want to total the quantities and just output one line for the total.

10.Although the Advanced Reformatting Utility has configurable overrides on the *LAST call  you may wish to add others such as HOLD(*YES) or IGCDTA(*YES) if you need to output to a Double Byte spooled file. You can use the *SPLOVR call to specify any overrides that are not already being used by the Advanced Reformatting Utility.

11.Finally, call ADVRFMT with PARM6 = *LAST to setup the printer queue and other output information to use, this triggers the creation of the new spooled file. This is a Mandatory call.