IVI: File Commands

IVI

File Commands

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.

Reminders

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 (quite near infinity!)

The filename may contain a directory path, and may include elements such as .. but not the csh 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:

OV testfile - store the current corefile on disk, replacing the existing file "testfile".
JO testfile|51 - append the current corefile beginning at line 51 to the file "testfile".
SA testfile| |100 - save the first 100 lines of the current corefile in a new disk file "testfile".
OV * - store the current corefile, overwriting the existing file whose name is on the status line.

Error Messages:

Empty filename - you haven't specified a filename.

File not found (or no write permission) - (for JOin or OVerwrite) the file does not already exist, or you don't have write permission for this file or directory.

File already exists (or no write permission) - (for SAve) the file is already present (in which case, use OVerwrite instead) or you don't have write permission for this directory.

Check name, not file fetched - (for OVerwrite) filename is different from the one in the status line, i.e. the file last fetched. This is a warning not an error. <DEL> aborts the command; <RETURN> proceeds with it.


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 csh 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:

FE myfile - fetch the whole of "myfile"
AP fred|1|10 - append the first 10 lines of "fred" to the corefile
IN hisfile|100 - insert "hisfile" from line 100 on into the corefile
FE herfile| |50 - fetch lines 1 to 50 of "herfile"
FE recfile| | |10??01 - fetch records whose extended check string matches 10??01

Error Messages:

Empty filename - you haven't specified a filename.

File not found (or no read permission) - the file is not present, or you do not have read permission for the file or directory.

Warning: corefile not saved - FEtch warns the user if s/he is about to destroy a corefile which has not been saved since it was changed. The user may continue to enter a filename, or may type <DEL> as usual to remove the command.

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:

NE oldname|newname - renames the disk file named "oldname" to "newname".

Error Messages:

Empty current file name

Empty destination file name

Overwrite file: <newname> ? - a disk file "newname" already exists.

Couldn't exec command to rename file - presumably you don't have permission to rename this file.


Return to IVI Reference Manual


Last revision: January 15, 2002.