Guardian Programmer's Guide

Table Of Contents
Using the IOEdit Procedures
Guardian Programmer’s Guide 421922-014
14 - 16
Handling “File Full” Errors
To renumber lines, supply the NUMBEREDIT procedure with the range of lines you
need to have renumbered, the new record number for the start of the renumbered set
of lines, and the record number increment.
The following example renumbers records 51200 through 80000, starting the new
record number range at 60000 and with a record number increment of 10:
FIRST := 51200D;
LAST := 80000D;
START := 60000D;
INCREMENT := 10;
ERROR := NUMBEREDIT(FILE^NUM,FIRST,LAST,START,INCREMENT);
IF ERROR > 0 THEN ...
Handling “File Full” Errors
Error 45 (file full) can sometimes return from a write operation, indicating that all the
space allocated to the file has been used. You can use the EXTENDEDIT procedure
to increase the extent size of the file; for example:
ERROR := EXTENDEDIT(FILE^NUM);
EXTENDEDIT functions as follows:
1. Creates a new file with the extended extent size
2. Copies the contents of the old file into the new file
3. Deletes the old file
4. Names the new file with the same name as the old file
5. Returns the new file number in the file-number parameter
The new file retains the same line numbering as the old file unless you specify a
starting record number and record increment in the call to EXTENDEDIT. The
following example renumbers the lines in the file, starting at line number 1, with a
record number increment of 1000:
START := 1000D;
INCREMENT := 1000D;
ERROR := EXTENDEDIT(FILE^NUM,START,INCREMENT);
Deleting Lines
Another common operation performed on EDIT files is to delete lines of text. To do
this, you supply the DELETEEDIT procedure with the range of lines that you want to
delete. DELETEEDIT deletes all lines with record numbers greater than or equal to the
specified starting record and less than the specified last record.