Creating a Report Request

In this section:

You can use any text editor to create your report request. Using the text editor, you can create ad hoc reports or create a report and save it as a stored procedure, enabling you to edit the request at any time. Stored procedures are described in more detail in the Developing Applications manual.

Beginning a Report Request

How to:

A report request begins with the TABLE FILE command and ends with the END command. The commands and phrases between the beginning and end of a request define the contents and format of a report. These parts of the request are optional; you only need to include the commands and phrases that produce the report functions you want. For example, if you want your report to be sorted, you need only include a sorting phrase.

Syntax: How to Begin a Report Request

To begin a report request, use the command

TABLE FILE filename 

where:

filename

Specifies a data source for the report.

Example: Issuing Report Requests

The following examples produce the same report:

 
1. TABLE FILE EMPLOYEE PRINT LAST_NAME BY DEPARTMENT
   END
  
2. TABLE FILE EMPLOYEE
   PRINT LAST_NAME
   BY DEPARTMENT
   END
  
3. TABLE
   FILE EMPLOYEE
   PRINT
   LAST_NAME BY DEPARTMENT
   END

The output is:

DEPARTMENT  LAST_NAME
----------  ---------
MIS         SMITH
            JONES
            MCCOY
            BLACKWOOD
            GREENSPAN
            CROSS
PRODUCTION  STEVENS
            SMITH
            BANNING
            IRVING
            ROMANS
            MCKNIGHT

Example: Reporting With a Default Data Source

An alternate way to specify the file name is with the SET FILE command. SET FILE establishes a default data source for all requests, as described in the Developing Applications manual. The following sets the EMPLOYEE data source as the default:

SET FILE = EMPLOYEE
 
TABLE
PRINT CURR_SAL
BY DEPARTMENT
END

This alternative is useful when you wish to enter several report requests against the same data source. Of course, you can still issue requests against other data sources simply by specifying the file name in the request instead of relying upon the default name.

Requesting Help When Issuing a Report Request

If you issue report requests interactively at the command prompt rather than from a procedure, online error correction is provided with help text after you issue the END command. For example, if you enter

TABLE FI EMPLOYEE
PRINT LAST_NAME FIRST_NAME
BY DEPARTMENT
END

at the command prompt, the following error message displays:

(FOC001) THE NAME OF THE FILE OR THE WORD 'FILE' IS MISSING

However, if the information provided by the error message is not sufficient, issue

? errornumber

for a more detailed explanation of the error.

Every command you enter is scanned, and a report is generated immediately after you enter the END command.

When the value of the MESSAGE parameter is ON (the default value), the number of records retrieved from the data source and the number of lines displayed in the report displays at the beginning of each report.

Completing a Report Request

To complete a report request, use the END or RUN command. These commands must be typed on a line by themselves. To discontinue a report request without executing it, enter the QUIT command.

If you plan to issue consecutive report requests against different data sources during one session, use the END command.

You also have the option of using the RUN command to complete a report request. The RUN command keeps the TABLE facility and the data source active for the duration of the TABLE session. This is useful since you do not need to repeat the TABLE command to produce another report using the same data source.

Selecting a Report Output Destination

Once you generate a report, you still need to display it. The following facilities are available for displaying your report:

Of course, you can easily direct the same report to both the screen and the printer by switching display modes and using the RETYPE command. Or you can choose not to display your report at all, and instead store the results as a data source using the HOLD, SAVE, or SAVB command. For details, see Saving and Reusing Your Report Output.


Information Builders