You are here: Job and Form Set Rules Reference > JDT Rules Reference > RULNestedOverFlowProc

RULNestedOverFlowProc

Use this form level rule to nest overflow within overflow. The nested overflow can occur on as many levels as necessary. This lets you use the system as a reporting tool. The only requirement is that the data occur in order.

This rule lets you create groups that contain group headers (lead sections), subordinate sections (list sections), and group footers (following sections).

Syntax

;RULNestedOverFlowProc;;;

Insert this rule in the AFGJOB.JDT file just after the RunSetRcpTbl rule.

To specify how the nesting occurs, you must create a file named OVERFLOW.DAT. You can create this file using any ASCII editor. By default, the system looks for this file in the DefLib directory, however, you can specify a different path and file name as the second parameter. Here is an example:

;RULNestedOverFlowProc;;c:\fap\dll\newfile.dat;

OVERFLOW.DAT file format

The file format for the OVERFLOW.DAT file is as follows:

;LeadIMG;LeadMask;ListIMGInfo;ListMask;FollIMGInfo;

Parameter

Description

LeadIMG

The group header inserted by normal triggering rules or by a previous call to the NestedOverflowProc rule. The group header is the section name without the extension of the lead section.

LeadMask

The search mask that originally triggered the lead section, in this syntax:

Offset,Record

Offset is the offset into the extract file. Record is the specific search key.

ListIMGInfo

Information about the subordinate section that overflows beneath the group header section. The format is the same as is in the FORM.DAT file:

SecName|SecAtts<Recip1(CpyCnt),Recip2(CpyCnt),…>

SecName is the name of the section without the extension.

SecAtts are the attributes of the section (using the flags used in the FORM.DAT file such as D=data entry and print, S=same page, W=can grow, and so on.

RECIP1 is the recipient name.

CPYCNT is the recipient copy count.

Normally, you should set the attributes to DS. (D=data entry and print and S=same page). This information should not exceed 255 characters.

ListMask

(Optional) The search mask which triggers occurrences of the subordinate section beneath the group header section. Use this syntax:

Offset, Record

Where...

Offset is the offset into the extract file.

Record is the specific search key.

If you omit this parameter, only one section is inserted.

FollIMGInfo

(Optional) Information about the group footer section which, if specified, is inserted after the last subordinate section for the current group. The format is the same as is in the FORM.DAT file:

SecName|SecAtts<Recip1(CpyCnt),Recip2(CpyCnt),…>

SecName is the name of the section without the extension.

SecAtts are the attributes of the section (using the flags used in the FORM.DAT file such as D=data entry and print, S=same page, W=can grow, and so on.

RECIP1 is the recipient name.

CPYCNT is the recipient copy count.

Normally, you should set the attributes to DS. (D=data entry and print and S=same page). This information should not exceed 255 characters.

Before this rule is called, the lead section should already be in the form set—either through normal section triggering or by placing another call to this rule on a previous line.

The system begins by reading the OVERFLOW.DAT file line by line. The system finds the first occurrence of the lead section in the form set and then finds the first occurrence of the lead mask in the extract file.

It then counts the number of list masks between the first and second lead mask. Next, the system inserts the number of list sections after the first lead section and then inserts the follow section.

The system continues going through the form set inserting the number of list sections in between the nth and (n+1)th lead sections, according to the number of list masks in the extract file in between the (n)th and (n+1)th lead masks.

When it reaches the last lead section, the system counts the remaining list section masks after the last lead mask and inserts the appropriate number of list sections. Lastly, it inserts the following section, if specified.

Note The following section and the list masks are optional. If there is no list mask, only one list section will be inserted.

Example

This example shows how to generate list sections subordinate to lead sections. In this example Record1 is the lead mask, and Record2 is the list mask.

LeadImage is the lead section and ListImage is the list section. The rule would count three Record2s between the two Record1s. If Record1 is actually the fifth Record1 in the extract file for the current transaction, the system would find the fifth LeadImage in the form set and insert three ListImages after this LeadImage.

Also, there is only one recipient, Recip1.

.

.

.

000000001RECORD1 data1

000000001RECORD2 data2

000000001RECORD2 data3

000000001RECORD3 data4

000000001RECORD4 data5

000000001RECORD4 data6

000000001RECORD2 data7

000000001RECORD1 data8

. . . .

. . . .

. . . .

The example below shows the line in the overflow file. In the first example, the corresponding line in the overflow file for the previous example would appear as shown here:

;LEADIMAGE;10,RECORD1;LISTIMAGE|DS<RECIP1(1)>;10,RECORD2;;

The next example shows how to add a following section. If a following section was needed, the line from the file would look as shown here. Assume the following section is named FOLLOWIMAGE:

;LEADIMAGE;10,RECORD1;LISTIMAGE|DS<RECIP1(1)>;10,RECORD2;FOLLOWIMAGE|DS<RECIP1(1)>;

This following example shows how to add another recipient. If a second recipient (with copy count of 3) was specified for the list section but not for the following section, the line would appear as shown here. Assume the second recipient is Recip2:

;LEADIMAGE;10,RECORD1;LISTIMAGE|DS<RECIP1(1),RECIP2(3)>;10,RECORD2;FOLLOWIMAGE|DS<RECIP1(1)>;

This example shows how to change the section attributes. So far the section attributes were set as DSdata entry and print and same page. If the list section was dynamic, you must add the W (can grow) attribute. The line would now look as shown here:

;LEADIMAGE;10,RECORD1;LISTIMAGE|DSW<RECIP1(1),RECIP(2)>;10,RECORD2;FOLLOWIMAGE|DS<RECIP1(1)>;

The example also shows nested/recursive functionality by iteration because this rule builds upon previous lines. This lets you have unlimited amounts of overflow within overflow.

Here are some points to consider concerning insertion logic:

Because of the nature of insertions, if two lines in the overflow file use the same lead section, the list section in the second line is inserted before the list section on the first line. This requires a sort of reverse logic when creating the overflow.

Consider two different sections triggered by two different masks that occur in the extract file and the overflow file in the following manner:

(extract file)

000000001LEADREC

000000001LISTREC1

000000001LISTREC2

000000001LISTREC1

(overflow file: note reverse insertion logic)

;LEADIMAGE;10,LEADREC;LISTIMAGE2|DSW<RECIP(1);;

;LEADIMAGE;10,LEADREC;LISTIMAGE1|DSW<RECIP(1);;

The sections would be inserted after LEADIMAGE in the following order:

LISTIMAGE2…LISTIMAGE1…LISTIMAGE1

However the POLFILE.DAT file would look as follows:

…/LEADIMAGE|DSW<RECIP>/LISTIMAGE1|DSW<RECIP>/LISTIMAGE1|DSW

<RECIP>/LISTIMAGE2|DSW<RECIP>/...

This excerpt demonstrates that the sections are not inserted in the order of list search masks in the extract file but in the reverse order of the occurrence of list sections in the overflow file.

Note If while processing the rule the system encounters invalid lines in the overflow file, it ignores those lines and adds log entries into the log file. The system then continues processing.

See also