Produces hard copy or screen reports.

 Report| DATABASE|  [/Qualifiers ...]
 | ARRAY[ ] /Form=FORMNAME |
DATABASEThe database on which to report.
ARRAY [ ]The array on which to report.
FORMNAMEThe form used to specify outputs for the report. A form must be specified when reporting on an array in order to obtain a meaningful result.
 The DML REPORT statement replaces the old REPORT Utility. It has the same basic functional capabilities as the REPORT Utility, except that the REPORT statement uses the language constructs of DML.
 You can create simple reports using just the REPORT statement and the FIELDS qualifier. To create more complex reports, you can use the REPORT statement and the /FORM qualifier in conjunction with the OUTPUT statements associated with a form.
 The REPORT statement facilitates scrolling up and down through each page of a report on your screen via the arrow keys. Once you have finished viewing a page, you can display the next page. Only one page is held in memory at a time.
Reporting on Arrays
When reporting on an array, as a convention, REPORT examines array element zero (e.g. ARRAY[0]) to determine the number of array "rows" on which to report. Therefore, you can report on the entire array or just a portion of it by specifying the appropriate value in array element zero.
When referring to an array in an output statement for a report, you are required to use the internal variable %ITEM as the first index (i.e. the "row" index). Subsequent indices in the reference, if any, enable you to access specific pieces of information in that "row" of the array. For example, a reference in the form ARRAY[%ITEM,n] would be used to access a specific piece of information in the "row" of Array indicated by %ITEM. In this example, n represents an index value which, when used in conjunction with the index indicated by %ITEM, forms a unique identifier for a specific piece of information in the array.
Arrays can also be passed as parameters to a report. To illustrate this feature, suppose that at the end of each month, you want to create a sales summary report for each or your four sales regions. You have created one array for each sales region, in which you have stored all sales data pertinent to the region for the month. These arrays are reg1sales[ ], reg2sales[ ], reg3sales[ ], and reg4sales[ ]. You would like to use the same report form for all four regions. To accomplish this, within the form, you should declare that an array will be received as a parameter. This declaration is made with the following statement:
Parameters sales[ ]
In this example, sales[ ] corresponds to the actual array that will be passed, which will be reg1sales[ ], reg2sales[ ], reg3sales[ ],or reg4sales[ ]. The REPORT statement's /PARAMETERS qualifier provides the method by which the actual array is passed to the report form. For example, the following statement would be used to produce the sales summary report for region three:
Report reg3sales[ ] /Parameters=reg3sales[ ] &

The DML REPORT statement includes additional General System Variables.
%COUNTCount of the number of records in each level break.
%EJECTEquivalent to "EJECT" when returned from a form or subroutine being executed by the Report statement. This causes a page eject and subsequent execution of PAGE_HEADING section.
%PAGEReport page number.
%REPORT_BREAKLevel break counter.
%REPORT_DATEDate of the report. This is the date and time the report was started.
%REPORT_PAGESame as %PAGE, except it is formatted with "PAGE nnnn".
%CENTERCenters the text on the form when used with '/COL=%kw' or '/POS=row, %kw' on Output.
%RIGHTRight justifies the text on the form when used with '/COL=%kw' or '/POS=row, %kw' on Output.

/Break=(expr [, keywords])
Specify the actions to be taken on intermediate level breaks.
 EJECTGo to the top of the next page after the level break has been processed. This is suppressed automatically if an outer (higher) level caused the break.
 EJECT_BEFOREGo to the top of the next page before the level break is processed. This is suppressed automatically if an outer (higher) level caused the break.
 GOSUBExecute a subroutine before processing the break. If the subroutine returns %ERROR, the level break is suppressed. If the subroutine returns %EJECT, a new page begins before the level break is processed.
 NOEXECUTEDo not execute the break_footing DML code contained in the form.
 NOTOTALSSuppress printing of totals for this level. (Nototals also implies Nounderlines).
 NOUNDERLINESSuppress printing of underlines before the totals.
 RESET_PAGEReset the page number counter so that the next page number will be one.
 SKIP [ = n ]Skip n lines after processing the level break. The default is one line. This will not skip past the end of the page.
 SKIP_BEFORE [ = n ]Skip n lines before processing the level break. The default is zero lines. You can specify -1 to stay on the same line (i.e. don't output the last record until the level break has been processed).
 TEXT [ = expr ]Merge a segment of text left-justified beside the totals. This expression can contain the level break field.
Text="Total for state " & CUSTOMER(STATE)
 TSUPRESSSuppress printing of totals (and text) if there is only one record in the level break.
Report AP &
 /Break0 = (Gosub = GRAND)
/Break = AP(VENDOR_NBR), Eject &
/Pointer &
 After all records have been processed for Accounts Payable, do a final break that executes a subroutine and calculates the grand totals.
 /Break0=( keywords, ...)
 Specify the actions to be taken on the final (grand total) level break. See keywords for /BREAK.
 Control the number of spaces between detail columns. The default is one. This overrides the form parameter.

 /Cspace=3 &
 Creates a report of all the customers in the CUSTOMER database placing three spaces between each field to be included in the report.
/Fields=(db(fld1) [,...db(fld12)])
 Specify the fields that you want to display in the report. You will probably use this only for simple reports. Any numeric fields are automatically totalled.
 Specify the form that contains OUTPUTs describing the report. Use a form for more complex reports. When writing to the screen, REPORT automatically toggles the screen width as required by the size of the form.
/Get [=([KEY=db(key)] [,START=expr] [,LIMIT=expr] [GENERIC])]
 A processing sequence for the database. Record selection is provided by the optional START and LIMIT parameters. If used in combination with the /GET_SUB qualifier, each record is fetched before the /GET_SUB subroutine executes.
 KEYIf the file is relative or sequential, the data is presented in record order sequence, and this should be omitted.

If the file is indexed, the specified key is followed. If no key is specified, and if the first field specified in the /FIELDS qualifier is a key field, then the database is accessed by that key. If it is not a key, the records are accessed by the primary key.
 STARTThe starting key (or partial key if GENERIC specified).
 LIMITThe ending key (or partial key if GENERIC specified).
 GENERICIf specified, the START and LIMIT keywords refer to partial keys.
Report AP &
/Get=(key=AP(NAME), &
 Start='A', &
Limit='B', &
 Create a report that Gets all names that start with the letter 'A' or 'B' using the key to do a partial match.
 Execute this subroutine as each record is read from the database. You can control whether or not the record is processed by using the following status returns:
 ReturnOK to process the record.
 Return %CONTINUEReject the current record, and continue processing.
 Return %ERRORStop reading records, and exit the report.
 Return %EXITStop reading records, and exit the report.
 If there is a /GET_SUB subroutine specified, and there is no /GET qualifier, then you are expected to get the records to pass to the report routine.
/Height=detail_height [, abs_height ]
 Controls the number of lines displayed on a page (the page height).
 detail_heightThe maximum height of the heading plus detail lines. The default is 55 lines.
 abs_heightThe absolute size of the page. Defaults to the detail height plus 10 lines. This usually leaves enough lines for totals and page footing lines on almost all reports.
/Height=33, 40
 Creates a report which displays only 33 lines of heading and detail on a page of 40 lines.
 Controls the number of blank lines displayed between lines of text. The default is zero. This overrides the form parameter.
 This places two (2) blank lines between each customer record.
 Shifts the entire report to the right by the value indicated by the given expression.
 Suppresses the detail column headings, but not the outputs in the PAGE_HEADING section.
/Output=filename [, form=queue_expr] [, APPEND]