ivi File Commands

File Commands

Initial reminders

In order to ensure that a command parameter string fits the command line on the display, the overall length of an IVI parameter string is restricted to about 45 to 50 characters. For excessively long file paths, the user may have to use the CDirectory command to change directory, so that the path can be omitted.

Many commands write help messages on the second-to-last line of the display, typically listing the command parameters. No action is required by the user, who can simply go on typing parameters as required.

Commands may also write error and warning messages. After an error message, the user must enter DEL or RETURN before continuing. In the case of a warning message, DEL aborts the command; continuing to type the parameters (or typing RETURN if there are no more) allows it to continue.


Commands: SAve, OVerwrite, JOin

Purpose: Transfer the contents of the current corefile to the named disk file. SAve creates a new file; OVerwrite replaces the disk file of the same name; JOin appends the corefile to the end of the disk file.

Format: SA filename|number|number

Parameters:The first parameter is the name of the file to be FEtched. The numbers are the line numbers of the part to be stored.

Except for the filename, the parameters are optional and are often omitted. If not supplied, the first number defaults to 1, the second to 200,000.

The filename may contain a directory path, and may include elements such as .. but not the home directory symbol ~

The symbol * may be used in place of the filename and/or the numbers. If it is, the filename is replaced by the one appearing in the status line. The numbers are replaced by the line numbers of the first and last stars (block flags) respectively.

For both JOin and OVerwrite, the specified filename must already exist. For SAve, the specified file must NOT already exist.

Examples:

Error Messages:


Commands: FEtch, APpend, INsert

Purpose: Transfer the contents of the specified disk file to the current corefile. FEtch replaces the corefile; APpend adds the disk file to the end of the corefile; INsert inserts it following the cursor line.

Format: FE filename|number|number|checkpattern

Parameters:The first parameter is the name of the file to be FEtched. The numbers are the line numbers of the part to be read. The last parameter is a ternary pattern as described in Editing Records: Extended Check.

The filename may contain a directory path, and may include elements such as .. but not the home directory symbol ~

Except for the filename, the parameters are optional and are often omitted. If not supplied, the first number defaults to 1, the second to 200,000.

The use of the symbol * in place of the filename and line number parameters is permitted, with the same interpretation as for SAve. This is a little strange, particularly in the case of starred lines, since these features relate to the existing corefile, not the one to be read.

If checkpattern is present, it takes the form of the ternary pattern described in Editing Records: Extended Check. In this case the commands will retrieve only records whose extended check string matches checkpattern.

FEtch also changes the filename associated with the current corefile, which appears on the status line.

If the incoming file exceeds the remaining space available for corefiles, the file is truncated, and an error message is displayed. A note about File overflow appears elsewhere in these webpages.

Warning: if a file exceeds 200,000 lines in length (about 3000 pages!), the use of 200,000 as infinity is problematic, since reading will terminate at that point without displaying an error message. In practice this would be most likely to occur if the file were a list, say, of words; otherwise the file would usually be truncated before 200,000 lines was reached.

Examples:

Error Messages:

Additional Comments on SAve, FEtch, etc.

A TAB character is interpreted by the read commands (FE, AP, IN) as a request to shift the material which follows to the next tabstop. SPACE characters are inserted as necessary. This can be prevented with ED 8. (See Miscellanea.)

The write commands (SA, OV, JO) do not attempt to replace SPACEs by TABs.

The characters \r (and a few others) at the start of a line are interpreted by the read commands as indicating a record. This can be prevented with ED 6.

The write commands prefix records with \r.

Traditionally lines in Unix files are terminated with a LINEFEED character (only); those in Windows, with RETURN LINEFEED. The ivi read commands require only the LINEFEED, and discard the RETURN. So either version of ivi can read files from the other operating system. The ivi write commands produce the correct form for their version. Other programs may not be so forgiving, so files produced by ivi under Unix may give problems to other programs under Windows. Both operating systems have programs to correct the form; indeed, FEtching and OVerwriting a file in ivi itself does so.

Every line read by ivi must have a LINEFEED. If the last line is missing one, ivi will discard it.

The ivi write commands discard spaces at the ends of lines. (So, indeed, do several other ivi commands and operations.)

The bottom line: if a file is FEtched and OVerwritten, it will not necessarily remain the same. Trailing spaces will be eliminated, TABs will be transformed to SPACEs, and line terminators will be standardized depending on the operating system.


Command: DElete

Purpose: Delete the named disk file

Format: DE filename

Parameter: The parameter names the disk file to be deleted

Error Messages:

Unable to delete file - either the file is not present or you don't have write permission for the file (which is needed to delete it.)


Command: UPdate

Purpose: (see below)

Format: UP

Suppose the name on the status line of the current corefile is "fred". The command first moves the existing disk file "fred" to "fred.bak", overwriting any previous file of this name, then it saves the current corefile to disk with name "fred". In effect, this is a two-step overwrite. If the user obeys it repeatedly, it overwrites the current file to disk, but preserves the immediately previous version.

Error Messages:

Empty filename - the filename in the status line is blank

File not saved, do the SAve command first - there is no existing file of this name.

Unable to create .bak file: error number Update cancelled. - presumably you don't have write permission for the .bak file or the directory.


Command: CLear

Purpose: Clear and re-initialize the current corefile.

Format: CL

CLear also clears the filename associated with current corefile.

Warning Message:

Warning: corefile not saved - the corefile has not been saved since the last change made.


Command: NAme

Purpose: Set the filename in the status line of the current corefile

Format: NAme filename

The filename is also changed by the FEtch and CLear commands.

The filename may begin with a directory path. If it does, the path is not displayed for space reasons, but the displayed name begins with /. The full path, however, is still stored, and is used if the user enters * as a filename parameter.


Command: NEwname

Purpose: Change the name of a disk file

Format: NE filename|filename

Parameters: The parameters are the old and new filenames respectively.

This is equivalent to the UNIX command mv (which is used to execute it.)

Example:

Error Messages:

Corefiles

The editing operations are carried out on one of 19 working files, numbered 0 to 18, referred to for historic reasons as corefiles. The user may switch back and forth between them, and may store them on or retrieve them from disk. Note that although the name of the file may appear in the status zone of the screen, the corefile is only a copy of this file, and changing it does not affect the disk version unless you explicitly save it or overwrite it. In addition, it is possible to move or copy material from one corefile to another.

Each corefile may be used for any purpose, but several have a special role; for example:

A corefile 19 exists internally, but is not accessible to the user.

Command: COrefile

Purpose: Change to a new corefile

Format: CO <number>

Parameters: The parameter is the number of the corefile to switch to.

Example: