Was this helpful?
Report Setup and Format
At the beginning of your report specification file, you must include some statements to perform the following setup tasks:
Name the report.
Set up a report results file.
Specify SQL statements to perform setup and cleanup tasks that occur before the main query is processed.
Specify the table, view, or query from which data is to be obtained.
Specify the optional inclusion of Report-Writer formatting statements residing in different files.
Define the order in which the data is to be sorted.
Define the break columns for the report.
Declare any variables used in the report specification.
Enter optional remarks and comments.
Use the .name statement to name the report, the .output statement to set up the report results file, and the .declare statement to declare variables for creating custom runtime query or formatting criteria.
Additionally, you can use the optional .setup statement to perform set up tasks (such as setting the lock mode, or creating a temporary table), and the .cleanup statement to perform clean up tasks (such as dropping a temporary table).
To obtain the data for your report, use either the .data or the .query statement. These statements are mutually exclusive. Use the .data statement to name a table or view in the database from which data can be obtained. Use the .query statement to retrieve a subset of the available data, based on the results of the query. By including parameters in the query, you can allow users to choose the criteria for the report at runtime.
To sort the data for your report, you must include a .sort statement in your report specification. The .sort statement lists the columns, in order of precedence, on which the data can be sorted. You also must specify the break columns, using the .break statement, if you want breaks to occur between data items in columns other than those specified in the .sort statement.
To ensure standardization between reports and to take advantage of repeated report formatting statements, you can create commonly used Report-Writer formatting statements in text files for inclusion in report specifications. The .include statement allows you to specify the text file containing the formatting statements. This statement can appear anywhere in your specification, if it is logically correct and is executed when you run the sreport command to store the report specification.
In addition to the report setup statements described above, you can include in your report specification some descriptive text about your report. The .shortremark and .longremark statements can be used to include text that appears on the RBF Save frame and in the MoreInfo display on the RBF Reports Catalog frame. Additionally, you can include comments anywhere in the report specification by enclosing them with the comment delimiters /* and */. The chapter “Report-Writer Statements” discusses the use and syntax of remark statements and comments in detail.
Last modified date: 08/14/2024