2.50 SAVE

Use SAVE to write a subset of the records to a new trail or extract file. By saving a subset to a new file, you can work with a smaller file that is easier to debug. Saving to another file also enables you to extract valid records that can be processed by , while excluding records that may be causing errors.

To set the version of the trail or file (to old or new format), use the TRAILFORMAT command.

Default

None

Syntax

SAVE file_name [!] {n records | n bytes}
[NOCOMMENT]
[OLDFORMAT | NEWFORMAT]
[TRANSIND indicator]
[TRUNCATE]
file_name

The name of the new file. To specify a trail file, specify the two-character trail name and a sequence number, for example rt000001.

!

Overwrites the specified file, if the same file already exists. First a purge is done, and then the specified records are saved to the file.

n records | n bytes

Specifies either a number of records or a number of data bytes to write to the new file. The n number of records or bytes are taken forward from the current position in the file. You can change the position with the POSITION command. See "POSITION".

EXT ( pri, sec [, max])

Specifies savefile extent sizes. This option is valid on NonStop only.

MEGABYTES n

Specifies the size of a savefile extent. This option is valid on NonStop only.

NOCOMMENT

Suppresses the leading and trailing comment records that are placed by default in the new file. These records describe the context of the file. The begin comment record contains source trail information and the position where the save started. The end comment record identifies the end of the saved data. These headers are useful to separate different sets of records that are saved to the same file, but can be omitted.

OLDFORMAT | NEWFORMAT

Writes the data in either the current trail format (NEWFORMAT, the default) or the format that was used for versions 6.0 and earlier (OLDFORMAT).

TRANSIND indicator

Sets the TransInd header field in the records written to one of the following:

FIRST
MIDDLE
END
ONLY

This allows you to reorder records in a transaction. TRANSIND applies to all records written by a SAVE command.

TRUNCATE

Purges an existing file before saving new information to it.

Example

SAVE /home/ggs/dirdat/rt000001 10 records nocomment

Example

SAVE $data01.glogggl.ss000000 100 records