BREAK

From CometWiki

(Difference between revisions)
Jump to: navigation, search
Line 21: Line 21:
To continue the BREAK command to the next line, end the line with a ";" and continue on the next line.  
To continue the BREAK command to the next line, end the line with a ";" and continue on the next line.  
   
   
-
'''History:'''  As of Release 97.04, break fields are filled with asterisks on the grand total line.
+
'''History:''' <br>
 +
  As of Release 97.04, break fields are filled with asterisks on the grand total line. <br>
'''Example:'''
'''Example:'''
   100  INPUT CUSTOMER
   100  INPUT CUSTOMER

Revision as of 12:35, 5 June 2009

BREAK
Syntax: BREAK [ON] field[;field][,N{ewpage}]
Placement: Place the BREAK command after the REPORT command.
Discussion: The BREAK command performs a control break, separating data into logical groups (such as subtotals on a new page) according to the data values in the specified field(s). The break occurs, and subtotals or a new page are issued, only when the data in the field changes. Therefore, BREAK is generally used in conjunction with a SORT of the same field. The field that follows the BREAK command may be the name of a field in the data file you are using. It may also be an expression that is defined in the data dictionary or has been described in the report with a DEFINE command.

The NEWPAGE parameter is optional and allows you to produce a new page for your report whenever the value of the break field changes.

The BREAK, TOTAL, and PRINT statements interact with each other. The BREAK command produces subtotals when a TOTAL command is also included in the report specification. If BREAK and TOTAL are used without a PRINT statement, a summary report is produced (no detail lines are printed).

The fields named in the BREAK statement are always printed. However, if the break fields are not also included in a PRINT command, the following takes place:


If the BREAK command appears before the PRINT command, the break field is printed at the beginning of the print line (i.e., the left-hand side of the report).

If the BREAK command appears after the PRINT command, the break field is printed at the end of the print line (i.e., the right-hand side of the report). It is normal to use the BREAK command on the same field or fields you use with the SORT command, or subtotals may appear on each line of the report.

Line continuation

To continue the BREAK command to the next line, end the line with a ";" and continue on the next line.

History:

As of Release 97.04, break fields are filled with asterisks on the grand total line. 

Example:

 100   INPUT CUSTOMER
 200   TITLE PAST.DUE.ACCOUNTS
 300   DEFINE PAST.DUE = AR.OVER.60 + AR.OVER.90;8.2
 400   SELECTING IF PAST.DUE GT 0
 500   SORT ON STATE;CUST.NAME
 600   REPORT
 700   USING CUST.TO.HIST
 800   PRINT CUST.NAME;CUST.NUMBER;STATE;PREVIOUS.YTD;PAST.DUE
 900   BREAK ON STATE
 1000  TOTAL PAST.DUE;PREVIOUS.YTD
1100  END
Personal tools