Creating SAVE and SAVB Files

How to:

The SAVE command, by default, captures report output in ALPHA format as a simple sequential data source, without headings or subtotals. However, you can specify a variety of other formats for SAVE files, which are compatible with many software products. For example, you can specify SAVE formats to display report output in a webpage, a text document, a spreadsheet or word processing application, or to be used as input to other programming languages. For a list of supported formats, see Choosing Output File Formats.

Regardless of format, the SAVE command does not create a Master File.

The SAVB command is a variation on the SAVE command. SAVB creates a data source without a Master File, but numeric fields are stored in BINARY format. You can use the SAVB file as input to a variety of applications. SAVB output is the same as the default output created by the HOLD command.

Syntax: How to Create a SAVE File

From a report request, use

ON TABLE SAVE [AS filename] [FORMAT fmt] [MISSING {ON|OFF}]

or

save_field SAVE [AS filename] [FORMAT fmt] [MISSING {ON|OFF}]

where:

save_field
Is the name of the last field in the request, excluding BY or ACROSS fields.
AS filename
Specifies a name for the SAVE file. If you do not specify a file name, SAVE is used as the default. Since each subsequent SAVE command overwrites the previous SAVE file, it is advisable to code a distinct file name in each request to direct the extracted data to a separate file, thereby preventing it from being overwritten by the next SAVE command.

You can also include a path, enclosed in single quotation marks, indicating where to store the SAVE file. For example:

ON TABLE SAVE FILENAME 'install_dir:\dir\filename.ext' FORMAT fmt
FORMAT fmt
Specifies the format of the SAVE file. ALPHA is the default format.
  • To display as or in a webpage:
    HTML, HTMTABLE, DHTML
  • To use in a text document:
    ALPHA, DOC, PDF, WP,  Text
  • To use in a spreadsheet application:
    DIF, EXCEL, EXL2K, LOTUS, (WK1), SYLK
  • To use in a database application:
    COMMA, COM, COMT

For details about all available formats, see Choosing Output File Formats.

MISSING
Ensures that fields with the MISSING attribute set to ON are carried over into the SAVE file. MISSING OFF is the default attribute. See Handling Records With Missing Field Values.

Example: Creating a SAVE File

The following request extracts data from the EMPLOYEE data source and creates a SAVE file.

TABLE FILE EMPLOYEE
PRINT LAST_NAME AND FIRST_NAME
BY DEPARTMENT
ON TABLE SAVE
END

A description of the ALPHA (default SAVE format) file layout appears after the records are retrieved.

The output is:

Syntax: How to Create a SAVB File

From a request, use

ON TABLE SAVB [AS filename] [MISSING {ON|OFF}]

or

save_field SAVB [AS filename] [MISSING {ON|OFF}]

where:

save_field
Is the name of the last field in the request, excluding BY and ACROSS fields.
AS filename
Specifies a name for the SAVB file. If you do not specify a file name, SAVB is used as the default. Since each subsequent SAVB command overwrites the previous SAVB file, it is advisable to code a distinct file name in each request to direct the extracted data to a separate file, thereby preventing it from being overwritten by the next SAVB command.

You can also include a path, enclosed in single quotation marks, indicating where you wish to store the SAVB file. For example:

ON TABLE SAVB FILENAME 'c:\dir\filename.ext '
MISSING
Ensures that fields with the MISSING attribute set to ON are carried over into the SAVB file. The default is MISSING OFF. See Handling Records With Missing Field Values.

Example: Creating a SAVB File

The following request extracts data from the SALES data source and creates a SAVB file.

TABLE FILE SALES
PRINT PROD_CODE AND AREA
BY DATE
WHERE CITY IS 'STAMFORD' OR 'UNIONDALE'
ON TABLE SAVB
END

A description of the BINARY file is appears after the records are retrieved.

The output is: