W - Write file.

Syntax:

W filename
WX filename
WA filename
WB filename
WXA filename
WXB filename

Examples:

w
wb /bcdfile
3,5wx temp

Options:

filename
is the name of a file in any form accepted by FRED. If you omit this name, FRED will write to the file associated with the current buffer. If there is no associated file name, FRED will give you an error.
File format
W can write files in either ASCII or BCD format. If the file associated with the current buffer is an ASCII file, W will write in ASCII format; if the file is a BCD file, W will write in BCD. If there is no file name associated with the current buffer, W uses ASCII as the default. The following two options let you specify which format to use in writing a file, regardless of the format associated with the buffer.
WA
writes out the file in ASCII format.
WB
writes out the file as a BCD card image.
X
displays statistics about the write operation even if the command is executed from a buffer. The format of these statistics is described below. Normally, FRED only displays these statistics if you type the W command directly.

Description:

W writes one or more lines to a file. If you do not specify an address, W writes the entire contents of the buffer. If you specify one address, W only writes that line. If you specify two addresses, W writes all the lines between and including the given lines. In this case, the first address must precede the second in the buffer.

W creates a file with the given name if one does not already exist. If the file name contains a slash /, FRED tries to create a permanent file; otherwise, FRED tries to create a temporary file.

When a write operation succeeds, statistics about the operation are printed on the terminal provided the W was not executed from a buffer. The statistics take the form

12,345,6789 b(name) user/cat/file

The first number gives the number of blocks read; the second number gives the number of lines read; and the third number gives the number of characters. After this comes the name of the buffer and the full name of the file.

If FRED creates a file in the write operation, it marks this on the same line as the statistics. A t shows that a temporary file was written while a p shows that a permanent file was created.

If you do not specify a line address in the W command, FRED sets the current buffer's file name to the name of the file written, as soon as the write is successfully completed. This associated name is the full name of the file, regardless of the name specified in the W command. Even if the command was

w /file

FRED will use the full name userid/file (if your current directory is your userid).

As a special convention, a W command with the line address 0, as in

0w filename

writes an empty file. If the file does not already exist, an empty file is created. This is the only time that a line address of 0 is accepted for W.

W does not affect the current line pointer ".". After a write operation, FRED sets the count register to the number of blocks written.

Copyright © 1998, Thinkage Ltd.