HP 3000 Manuals

Report Processing Logic [ HP ALLBASE/4GL Developer Reference Manual Vol. 1 ] MPE/iX 5.0 Documentation


HP ALLBASE/4GL Developer Reference Manual Vol. 1

Report Processing Logic 

The HP ALLBASE/4GL report processing logic can be thought of as operating
on two levels.  In this manual, the two levels are referred to as the
report control logic, and the report line group logic.  The report
control logic is the overall controlling logic for a report, and the
report line group logic is the logic that controls the printing of a
single line group within a report.  In a typical report, HP ALLBASE/4GL
executes the line group logic many times.

Report Control Logic 

The overall report control logic can be thought of as being subdivided
into three components.  These components are:

   *   Report initialization logic.

   *   Report record processing logic.

   *   Report completion logic.

Report Initialization.   

Figure 7-1 shows the report initialization logic.

[]
Figure 7-1. Report Initialization Logic Report generation is initiated by a REPORT logic command, or an R- action from a menu. At the end of the report, control returns to the next command in the logic block that initiated the report, or to the menu that initiated the report. At the start of a report, the report generator executes the start-of-report function if you have specified one. The start-of-report function can execute any logic command except REPORT. A typical use for this function is to display a screen to obtain user input for report selection criteria. If the report uses an HP ALLBASE/SQL data base, this function can execute an SQL logic block containing a SELECT command to retrieve data for reporting. The report generator then performs any necessary record selection and sorting, and writes the selected and sorted records to a temporary file. It then prints the page heading, column heading, and subheading line groups for all defined control break levels and then enters the report record processing logic.
[]
Figure 7-2. Report Record Processing Logic Report Record Processing Logic. Figure 7-2 shows the report record processing logic. The report record processing logic is executed for each record in the temporary file of selected and sorted records. For each record, the report generator checks if the record initiates a control break. If no control break is present, the report generator prints a type D1 line group and then reads the next record. If the record just read initiates a control break, the report generator prints the type T and type H line groups corresponding to the initiating control break level, and for all lower level control breaks. For example, if you define a report with four control break levels, a control break at level 2 initiates printing of type T line groups and type H line groups for level 2, level 3, and level 4 control breaks. When the report generator detects the end of the temporary report file, it executes the report completion logic. Report Completion Logic. Figure 7-3 shows the report completion logic.
[]
Figure 7-3. Report Completion Logic After the last record for reporting has been processed, the report generator executes the end-of-report function. The report generator then prints all the control break type T line groups and prints the type TF grand total line group. Control then returns to the logic block or menu that initiated the report. Report Line Group Logic The report generator executes the report line group logic for every line group it prints, regardless of the line group type. Figure 7-4 shows the line group logic. The first actions in the line group logic are to set *BYPASS to off and execute the before-print function for the current line within the group. For the first line only in a line group, the report generator checks if there are file linkages defined for the line group. If you have defined linkages for the group, the report generator tests the status of *ENDLINE. If *ENDLINE is off, the report generator performs the initial read of each link file and executes the post-read functions for the file linkages. If *ENDLINE is on, processing of the current line ceases. This allows you to conditionally bypass the link file read and terminate the line by setting *ENDLINE on in the before-print function. For all lines in the line group, the report generator then checks the status of the switch *ENDLINE. (Note that for the first line in the group, this is the second time that *ENDLINE is tested if you have defined a file linkage for the line group.) If *ENDLINE is off, the report generator executes the line printing logic (See Figure 7-5). If *ENDLINE is on, the report generator terminates processing of the current line group and processes any defined link print line groups. After the line printing logic has been executed for any given line within a group, the report generator checks if there are any more lines defined for the group. If there are any more lines to be printed, the report generator returns to the start of the line group logic.
[]
Figure 7-4. Line Group Logic If all lines for the line group have been printed, the report generator processes any link print groups that are to be printed. For any file linkage that has an associated link print line group or an end-of-link print line group, the report generator continues to read records from the link file and print link line groups until one of the following conditions occurs: * The end of the link file is reached. * The value in the key field for the record read from the link file does not match the value of *KEY specified for the file linkage. * *ENDLINE is set on in the post link read function. At the end of each link, the report generator prints the end-of-link line group if one is defined and then processes any remaining linkages. If there are no remaining unprocessed linkages, the report generator returns to the main report processing logic and executes the step following the one that initiated printing of the line group. Line Printing Logic The line printing logic controls the printing of each physical line on the report page. Figure 7-5 shows the line printing logic. For each line within a line group, the report generator checks the status of *BYPASS. If *BYPASS is on, the report generator immediately executes the line's after-print function and returns to the line group logic without printing the line on the page. If *BYPASS is off, the report generator updates the totalling fields *TOTALS and *CROSS, and the line counter fields *COUNT as required. It then checks that there is enough space on the physical page to print the line. If there is sufficient space, the line is printed immediately. If there is insufficient space on the page, the following actions occur before the line is printed: * The bottom-of-page line group is printed. * The paper is positioned at the top of the next page. * The top-of-page heading line group and the column heading line group are printed. Then the line itself is printed. After printing the line, the report generator resets the *CROSS fields and then executes the line's after-print function. Control then returns to the line group logic.
[]
Figure 7-5. Line Printing Logic


MPE/iX 5.0 Documentation