Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ IntroductionA. System overviewB. Program executionC. FilestoreD. GEORGE commandsE. Introduction to Multiple On-line Programming (MOP)F. Input of background jobsG. Editing filesI. Budgeting, scheduling and accountingJ. Monitoring filesL. FORTRANM. ALGOLN. Assemblers PLASYD, PLANP. ConsolidatorQ. LibrariesR. Data storage □ Sections S-Z unavailable □ S. Large program organisationT. User utilitiesV. Graphics packagesW. Other packagesX. Efficient use of the 1906AY. 1906A hardwareZ. Peripheral equipmentList of reference manualsIndex
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

   
ACLLiteratureICL 1906A manuals1906A Reference Manual
ACLLiteratureICL 1906A manuals1906A Reference Manual
ACL ACD C&A INF CCD CISD Archives
Further reading

IntroductionA. System overviewB. Program executionC. FilestoreD. GEORGE commandsE. Introduction to Multiple On-line Programming (MOP)F. Input of background jobsG. Editing filesI. Budgeting, scheduling and accountingJ. Monitoring filesL. FORTRANM. ALGOLN. Assemblers PLASYD, PLANP. ConsolidatorQ. LibrariesR. Data storage
Sections S-Z unavailable
S. Large program organisationT. User utilitiesV. Graphics packagesW. Other packagesX. Efficient use of the 1906AY. 1906A hardwareZ. Peripheral equipmentList of reference manualsIndex

G. Editing Files

G.1 INTRODUCTION

This Part describes how to change, or edit, the contents of a basic file. Part T describes utilities which can be used to edit the contents of discs and magnetic tapes. The editor considered here is built into the GEORGE system and is basically a context editor. It can be used in connection with either MOP or background jobs. Also available, for users who prefer it, is a less versatile line editor which can only be used by background jobs and this is described in Part T.

Editing is the process of changing, adding to, or deleting parts of a file. This is achieved by copying the original file (oldfile) to a new version (newfile), making the required changes in the process. This is done by means of an editor which accepts instructions from the user about which sections of oldfile to include in, or omit from, newfile and what additional information, if any, to insert into newfile.

At the end of a successful edit, in most cases, oldfile is no longer required (newfile being the required version), and this type of editing may be achieved by use of the CORRECT macro (D.3.5). This takes care of the erasure of oldfile at the end of a successful edit and is also fail safe, should a system break occur during an edit. In this case, the oldfile is always preserved, no trace of newfile being left.

Where a user wishes to keep both oldfile and newfile or edit from a background job (for which use CORRECT is not recommended), he can use the more basic EDIT command.

CORRECT, in fact, uses the EDIT command but simplifies the editing process. The EDITOR will now be described in terms of its use via CORRECT from a MOP terminal. The EDIT command (D.3.4) and editing from a background job will be described later.

Users are warned that traps may not be preserved from oldfile to newfile.

G.2 EDITING FROM MOP

G.2.1 USE OF CORRECT

Given a file FRED, this is edited by giving the following command on a MOP terminal:

CORRECT FRED

GEORGE will then reply:

EDITOR IS READY
0.0 ←

From this point onwards, all inputs from the user are instructions to the EDITOR about the changing of file FRED, until either a Q or an E instruction is given. The Q instruction is used after an irrecoverable mistake has been made during an edit and aborts the edit, erasing newfile and retaining oldfile and gives the messages:

EDIT ABANDONED DISPLAY: OLD FILE KEPT

The terminal is then ready for the user's next GEORGE command.

The E instruction is used to terminate a successful edit (this will be described in more detail later) and causes oldfile to be erased, newfile to be kept and the following messages to be displayed:

EDIT OK
DISPLAY: NEW FILE KEPT

The terminal is then ready for the next GEORGE command.

After a successful edit the file has its generation number incremented by one. Thus FRED(8/) becomes FRED (9/). After an aborted edit, the file is still FRED(8/). There are other possible ends to an edit caused by unusual conditions and these are described later.

G.2.2 CONCEPTS OF EDITING

A basic file consists of a series of records which, for all practical purposes, correspond to a unit on a physical medium (for example, a card or a line of output printed on a MOP terminal or lineprinter). Each record contains zero (for a blank line) or more characters.

Editing is controlled in terms of a pointer which is moved (usually forward) through oldfile and, depending on the editing instruction given, the information passed over is either copied (transcribed) to newfile or not. Records are numbered from the beginning of the file commencing at 0 and characters within a record are numbered from left to right commencing at 0. Record numbers correspond to the numbers given on a file listing when the LISTFILE command is qualified by NUMBER (D.3.3).

The position of the pointer within oldfile is given by a number r.c where r is the record number and c is the character number. When editing commences, the pointer is before the first character of the first record which is 0.0. Movement along a record increments c as characters are passed over. When the next record is commenced, r is incremented and c reset to 0. The position of the pointer is reported back to the user after each input of editing instructions and also when editing commences (as shown in the previous example of CORRECT).

Editing instructions may be input singly or in groups where they are separated by a comma. They are input to the EDITOR when the ACCEPT key is pressed in the same manner as GEORGE commands.

G.3 EDITING INSTRUCTIONS

G.3.1 INTRODUCTION

The EDITOR instructions are all single character mnemonics which, in most cases, are followed by a parameter. A list of these instructions is given at the end of this Part for reference purposes.

There are three main functions required when editing a file. To copy (or Transcribe) information (records or parts of records) from oldfile to newfile is achieved by the T instruction. To omit (or Pass over) information in oldfile from newfile is achieved by the P instruction. To Insert information into newfile is achieved by the I instruction.

G.3.2 T AND P INSTRUCTIONS

Both T and P instructions require a parameter to indicate the position (the endpoint) in oldfile where the pointer is to be moved. The endpoint may be given in various ways and has the general format of r.c. The character r defines to which record the pointer is to be moved and the following .c defines the position in this record to which the pointer is to be moved. Either r or .c may be omitted, but note the presence of the . with c and its absence, if .c is omitted. Absence of r means the pointer is moved within the current record. Absence of .c positions the pointer at the beginning of the specified record.

Movement of the pointer is always forward through a file for the T instruction but may also be backward for the P instruction. This is indicated by a negative sign in front of either r or c..

G.3.2.1 Definition of r

A record may be located in any of the following ways, the pointer being left at the beginning of the record (a delimited string will be defined later):

(1) #n                 : record n of the file.   This is the same as the number of a record 
                         given in a LISTFILE command qualified by NUMBER (n is decimal).
(2) n                  : n records from, and including, the current record.
(3) delimited string   : the record beginning with string. Spaces are significant.
(4) S delimited string : the record beginning with string. Leading spaces are not significant.
(5) C delimited string : the record Containing string.
(6) E                  : the End of the file. The pointer is left after the last actual record.

G.3.2.2 Definition of .c

A character may be located within a record in any of the following ways, the pointer being left before the character indicated below:

(1) .n                 : n  characters from the current position of the pointer in the record .   
                         If a T instruction moves the pointer off the end of the record, 
                         the newfile record has spaces inserted.
(2) .delimited string  : the first character of the next occurrence of string in the record 
                         or the end of the record if string is not found.
(3) .E                 : the end of the record.   The pointer is left after the last 
                         character in the record.

G.3.2.3 Definition of a Delimited String

A delimited string is a sequence of characters enclosed in identical string delimiters, which may be taken from the set:

:  ;  >  =  <  ?  !  "  £  %  &  '  +  /

Note that spaces are significant within a string and that the string delimiter must not occur within the string. Examples of a delimited string are:

/ABC/   :ABC:   <AB<   ?12AB57?   !7 FORMAT!

The choice of delimiters is provided so that they may not clash with the characters in the string. Look at:

K=I/J

If the symbol / was used for the delimiter, this would cause an error, but a : would not.

G.3.2.4 Examples of T and P Instructions

Some examples showing movement to a record are:

T2  T#2  P/ABC/  TS/ABC/   TC/ABC/   TE

Some examples showing movement within a record are:

T.2  T./ABC/  P.E

Some examples showing movement to a record and then within it are:

T2.2  T#2./ABC/  PC/ABC/./ABC/  T2.E

G.3.2.5 Use of T and P Instructions

If the file FRED contains the following records:

ABCD 
/DEF 
  1234

and the file is edited using the CORRECT macro then the initial pointer would be before the A in record 0 (that is at position 0.0).

The instruction T.2 or T./C/ would move the pointer along record 0, copying AB into newfile and leaving the pointer before C with a value 0.2.

The instruction T1, T:/: or TC/DEF/ would move the pointer to the beginning of the next record and to a value 1.0, having copied record 0 into newfile.

The instruction TS/123/, T/  123/, TC/123/ or TC/34/ would move the pointer to the beginning of record 2 with a value 2.0, having copied all previous records to newfile.

The instruction TE or T#3 would copy the entire file to newfile and position the pointer at the beginning of an imaginary record 3 with a value 3.0.

If, in the above instructions, the P instruction had been used instead of T, then the information the pointer moved past would have been omitted from newfile.

If the P instruction had a negative endpoint, for example P-/ABC/, the pointer would have moved backwards from its present position to, in this instance, the record commencing ABC giving a pointer value of 0.0. This feature is not recommended for those unfamiliar with the EDITOR.

The T may in fact be omitted where endpoint is expressed as n or #n. Thus the following instructions are identical:

1     T1

G.3.3 INSERTION OF TEXT - I

The insertion of text into newfile is done by means of the I instruction which has the form:

I delimited string

A delimited string is as defined earlier except that only in this case can the string be spread over several records; that is several lines of text each of which is input by pressing the ACCEPT key on a MOP terminal. Users should note that the Return and Line Feed keys on a MOP terminal have no effect whatsoever on the contents of the file. When inserting text, instead of giving the current position of the pointer when ACCEPT is pressed, the EDITOR replies with the delimiter being used for that insertion. The insertion is terminated when the matching string delimiter is given.

G.3.3.1 Examples of I Instruction

Some examples of insertion within a record are:

I/ABC/ 
I?1234567? 
I:     C=A/B:

Some examples of insertion of new records are:

I/ABC
/
I:
:
I/      WRITE(2,10)I,J,K 
10    EORMAT(I5,I7,I5)
      DO7,M=1,10 
      MM=I+M
/

G.3.3.2 Use of I Instruction

Given the file FRED:

ABCD
/DEF 
  1234
  

The user wants to do the following:

(1) Add GH between B and C in record 0.

(2) Add the record MNO/PQ after record ABCD.

(3) Add IJ at the end of record /DEF.

(4) Add a record THE END, followed by a blank record and then **** a the end of the file.

The EDITOR is called by the CORRECT macro and the pointer is initially 0.0.

The instruction sequence for (1) is:

T.2,I/GH/

The pointer is left before C and to copy the remainder of the record to newfile, the instruction given is:

T1

The pointer is now-at the beginning of record 1 with a value 1.0. To achieve (2) the instructions are:

I:MNO/PQ
:

Note that ACCEPT is pressed after I:MNO/PQ to input a record into newfile. The second : shows that the insertion has ended. The difference between the two insertions given in the examples should be clearly noted. In the first, the insertion was within a record; in the second, a new record was inserted into newfile.

Item (3) is done by the following instructions:

T.E,I/IJ/

The pointer was initially at the beginning of the record, and T.E copies to the end of the record. The insertion is made at this point.

Item (4) is done by the following instructions:

TE
I/THE END
****
/

The TE copies the remainder of oldfile to newfile and the insertion adds three new records into newfile. Note that the blank record is inserted by simply pressing ACCEPT when GEORGE requests the next record during the insertion.

The newfile now consists of:

ABGHCD
MNO/PQ
/DEFIJ
  1234 
THE END
****

G.3.4 TERMINATING AN EDIT

The two instructions which terminate an edit, Q and E, have already been introduced and can now be defined more fully.

The Q instruction (or Quit) simply aborts the entire edit reverting the file back to its original form (no matter what editing instructions have been applied to it) by erasing newfile and retaining oldfile.

The E instruction is used for a successful end to an edit and causes the remainder of oldfile to be copied to newfile (equivalent to TE) and then terminates the edit, returning the user back to GEORGE for his next command.

G.3.5 MONITORING THE PROGRESS OF AN EDIT - W, L AND N

When editing a file, it is useful to be able to see the record to be edited and also the new version written to newfile. This is achieved by two instructions to the EDITOR which act as switches. The first occurrence of the instruction puts the feature on, a second occurrence switches it off, a third on, and so forth.

The U instruction controls the listing of oldfile, and the L instruction the listing of newfile. A third switch type instruction, N, causes the listing of newfile under the control of the L instruction to be numbered. The setting of all these switches at the beginning of an edit is off.

G.3.5.1 W (Window) Instruction

This has either of the following forms:

W       which  reverses   the window state
W ON    which puts the window on
W OFF   which puts the window  off

Whenever window is on, the re-positioning of the pointer to somewhere within a new record causes that record to be listed. Records that the pointer passes through are not listed. When window is first switched on, the current record is listed. A record listed by window is preceded by @← and two spaces. The same record cannot be listed twice.

G.3.5.2 L (List) Instruction

This has an identical form to the W instruction and causes each new record transcribed to newfile to be listed (left justified) on the MOP terminal. Whereas the W instruction shows a record before any editing is done, the L instruction shows the record after it has been edited and as it now appears in newfile.

G.3.5.3 N (Number) Instruction

Again, this has an identical form to the W instruction and is used in conjunction with the L instruction so that the listing that the latter produces is numbered with the record numbers corresponding to newfile.

G.4 A SAMPLE EDIT

Below is a sample of the use of the EDITOR to do the insertion example which is cited previously:

09.05.27+- RETRIEVE  FRED
:NTBE34.FRED(34/)   IS  ALREADY  ONLINE
09.05.34← LISTFILE FRED
ABCD
/DEF
  1234 
09.05.44← CORRECT FRED
EDITOR IS  READY
0.0← W
@←  ABCD
0.0← T.2,I/GH/,L,T1,L
ABGHCD
@←  /DEF
1.0← I:MNO/PQ
:← :
1.0← T.E,I/IJ/,L,T1,L
/DEFIJ
@←    1234
2.0← TE
3.0← I/THE END
/←
/← ****
/← /
EDIT OK
DISPLAY:   NEW FILE  KEPT 
END OF MACRO 
09.07.16← RETRIEVE  FRED 
:NTBE34.FRED(35/) IS ALREADY ONLINE 
09.07.27← LISTFILE  FRED 
ABGHCD 
MNO/PQ 
/DEFIJ 
  1234 
THE END
****
09.07.4←

The following points should be noted:

(1) The RETRIEVE and LISTFILE commands are used simply to illustrate the increase in the generation number of FRED after a successful edit and the contents of FRED before and after the edit.

(2) The W instruction is used to show the record about to be edited. Its initial use gives the record ABCD and all subsequent movements of the pointer to a new record result in that record being listed. No listing is given when the TE instruction is given as no record exists after the end of the file.

(3) The sequence L,T1,L switches the Listing on, copies one record and then switches the Listing off. This is a very useful sequence of instructions which can be used to observe the record being created in newfile as a result of the edit. Users should keep the Listing switch off when editing large files as a TE or E instruction would cause the remainder of the file to be listed on the MOP terminal. See G.9 for further details on recovery from such errors and for techniques in using the Listing switch.

(4) During record insertions, the EDITOR replies with the string delimiter being used (either : or / in this instance) and insertion continues until this character is matched by the user.

G.5 ADDITIONAL EDITING INSTRUCTIONS

G.5.1 REPLACE INSTRUCTION - R

This is used to replace a string within a record by another string, and has the form:

R/oldstring/newstring/

Starting at the current position of the pointer, the first occurrence of oldstring within the current record is replaced by newstring (which may be null, for example //). The delimiter / may be replaced by any of the string delimiters defined earlier. If oldstring is not found within the current record, the pointer is left at the end of the record. No replacement is done and an error message is given. If oldstring is found, then the pointer is left pointing before the next character after oldstring.

For example, consider the current record:

ABCDEFGHIAB

If the pointer is at the beginning of the record then:

R/GH//

would delete GH from the record in newfile and leave the pointer before I. This is equivalent to the sequence of instructions:

T./G/,P.2

Consider the instruction:

R/AB/JK/

If this is applied after the previous example, it would replace the second occurrence of AB in the record (since R/GH// has already moved the pointer past the first AB) by JK and is equivalent to the sequence:

T./AB/,P.2,I/JK/

The pointer would be left at the end of the record.

G.5.2 AFTER AND BEFORE INSTRUCTIONS - A AND B

The A and B instructions have the same format as the R instruction but instead of replacing oldstring, they insert newstring either After (A), or Before (B), oldstring. For the A instruction the pointer is left after oldstring, for the B instruction, before oldstring. If in:

ABCDEFIJ

the pointer was initially at the beginning of the record, to insert GH between F and I could be achieved by either of the following:

A/F/GH/ 
B/I/GH/

These are equivalent to the sequence:

T./I/, I/GH/

In all cases the pointer is left before I.

G.5.3 FORGET INSTRUCTION - F

When a user gives a valid editing instruction but then realises that it was incorrect (for example, he transcribed or erased too many lines or a string did not exist), rather than abort the whole edit, he can Forget the previous record of editing instructions by use of the F instruction. This causes the EDITOR to revert oldfile and newfile back to the situation appertaining when the last record of editing instruction(s) was given. In this instance, a multi-record Insertion is treated as a single editing record. Two or more consecutive F instructions are not allowed and it is recommended that, when used, the F instruction should be the only one in that record. While it reverts the state of the files, any changes to the W, L, and N switch settings are not changed back.

For example, the following sequence of instructions will leave the user back where he started after each F instruction:

(1)  P9
     F
(2)  P8,T1,I/ABC/ 
     F
(3)  T/ABC/,P.E,TE 
     F
(4)  R/ABC/CD/
     F
(5)  T2,R/ABC/CD/ 
     P6,F
(6)  I/ABC
     DEF 
     G
     /
     F
(7)  P6
     I/ABC
     DEF
     G
     /,F
(8)  W
     F
(9)  T5,W 
     F

The following points should be noted:

  1. The F instruction can be used whether or not the previous instruction(s) caused an error. Thus, in example (3), if the T/ABC/ instruction either failed to find a record beginning ABC (thus giving an error) or found the wrong record, the F instruction would redeem the mistake. Similar comments apply to example (4).
  2. The result of the F instruction in (5) should be noted, as it forgets not only the P6 but the previous record of EDITOR instructions. It is a very common mistake to try to use F to forget the P6. This is best achieved by cancelling the line.
  3. Examples (6) and (7) illustrate the mistake of example (5) in the case of insertions. In this instance the complete insertion is regarded as a record. Hence, to forget the insertion, the F must be the next instruction record to the EDITOR, as in (6). Should the F be applied, as in (7), the result is similar to example (5) and the insertion and the previous record are forgotten.
  4. Example (8) illustrates a common error in that a user moves the pointer to a record, switches on the Window facility, and on finding he has gone past the record he requires, wishes to forget the instruction preceding the W. This cannot be done and the correct technique is shown in example (9).

G.5.4 DUMMY CHARACTER INSTRUCTION - D

It is possible to specify dummy (ie unknown) characters within a string that is used in moving the pointer. This is done by the D instruction which has the form:

Dc

when c is any character. If c is null, any character previously specified as a dummy reverts to its normal meaning, otherwise the character c is used as a dummy.

This facility is most useful when repetitive editing is being done on a set of strings with a common denominator. For example, if a file contains variables I1NAME, I2NAME, I3NAME and it is required to change them to A1NAME, A2NAME, A3NAME, one way of doing this would be to use the repetitive edit facility (specified later) as shown below:

D?,(TC/I?NAME/,(T./I?NAME/,R/I/A/).E,T1)E

Note that ? is the dummy and enables I1NAME, I2NAME, I3NAME to be accessed by the same T instruction.

G.5.5 VISIBLE SPACE INSTRUCTION - V

In some instances (for example, when editing FORTRAN programs), it would be easier to count how many spaces had been inserted if they could be shown by a visible character. Such a character can be nominated by the V instruction which has the form:

Vc

where c is any character.

If c is null then any previous setting is revoked, otherwise the character c is interpreted within strings as a space character.

For example, the following are equivalent:

V*,T/***J/,V
T/   J/

Note that the second V instruction need not be given until * is no longer required to represent a space. Note also that a space is still a space whatever the setting of V.

G.5.6 USE INSTRUCTION - U

This allows editing instructions to be read from a file instead of from the MOP terminal and can be useful if a sequence of instructions has to be applied to several parts of a file. It has the form:

U filename

where filename contains editing instructions, which can include further U instructions up to a maximum of 23. The U instruction is not recommended to inexperienced users since, should the editing instructions in filename contain an error, then the EDITOR can sometimes simulate an E instruction. This will copy the remainder of oldfile over to newfile, that is, that part after the position of the pointer where the error was detected. However, the message EDIT OK will not be given and CORRECT will keep both oldfile and newfile giving a message to the terminal to this effect. See G.8.2 for error messages from the CORRECT macro.

Editing instructions in a record following a U instruction are ignored, The last instruction in the file of editing instructions must either terminate the edit (E) or be a Z which switches the source of editing instructions back to the MOP terminal. Hence, given a file JIM containing:

R/ABC/DEF/ 
Z

If the file to be edited contains:

ABC 
DEF

the file can be edited by the instruction:

U JIM

If the pointer is at the beginning of ABC initially, it will replace ABC by DEF and return control to the user with the pointer at the end of the record ABC.

G.5.7 ORIGIN INSTRUCTION - O

The origin instruction is used to reset the record numbering in oldfile. It is especially useful in enabling one to align the record numbers given by the EDITOR with those on.a numbered listing of an earlier version of the file.

The origin instruction has the two forms:

On

The parameter n is a decimal number (or null, in which case zero is assumed), and causes the current record number to be reset to n.

O#

This causes the record numbers to be reset to their absolute values.

After giving an 0 instruction, the EDITOR will reply with the new record number of the current record. All editing instructions which refer to record numbers (for example T#51) will be interpreted in terms of the new record numbering.

For example, a user has a numbered listing of a file. The file is then edited and two records are inserted. Thus, on a subsequent edit, all the record numbers after this insertion are increased by two and, therefore, if he wishes to refer to a record numbered n in his listing, he must make allowance for the extra two records and refer to record n+2 . This can be simplified by resetting the record number after the insertion to correspond to the listing. Thus, when he has moved the pointer past the insertion (say to record 574), to renumber this to correspond to his listing (ie 572), he gives the instruction:

O572

Then to copy to record 592 of his listing, the instruction given could be:

T#592

G.5.8 CHANGE PFCC INSTRUCTION - H

Preceding each record of a file within the filestore are two words of red tape information, the second of which controls the printing of the file. It is possible to change this latter control (known as the Paper Feed Control Character or PFCC) by use of the H instruction. This can be useful in cases where, say, a page-throw was to be inserted in a file listing or the file had been produced in an abnormal manner and had not got the correct PFCC on its records. The H command has the formats:

  1. H#octalnumber
  2. H

The first format causes all subsequently transcribed records to have a PFCC of #octalnumber. The second format switches off any previous H instruction and causes no change to the PFCC of subsequently transcribed records.

Valid values for the PFCC are:

#41 Advance to newline before printing the record - normal PFCC for a file.
#51 Advance to new page before printing the record.
#40 No movement before printing the record - results in overprinting.

The use of the H instruction may be as follows:

H#51,T1,H

This sequence will cause the current record to be printed at the start of a new page.

Another use is:

H#41,TE

This causes all records to start on a new line (which is the normal setting).

G.6 INSTRUCTION REPETITION

A sequence of editing instructions can be repeated by placing the sequence within brackets followed either by *n or an endpoint. The parameter *n means the sequence should be repeated n times while endpoint means the repetition should be performed until endpoint is reached.

For example, to remove the sequence numbers from a FORTRAN program in column 72 onwards, the following would suffice:

(T.72,P.E,T1)E

Note that, in this instance, endpoint is the end of the file denoted by E. If the following sequence was used:

(T.72,P.E,T1)*10

this would carry out the instructions for 10 records. Consider the following:

(T.72,P.E,T1)/****/

This would carry on until a record beginning **** was encountered.

Instruction repetition can also be used to replace all occurrences of a string by a different string. For example, if the variable JUNK in a program was to be replaced by FRED, then the fact that JUNK may occur more than once within a record must also be catered for. Replacement of JUNK by FRED within a record is achieved by:

(R/JUNK/FRED/).E

Note that the .E terminates the repetition at the end of the record. To do this for all records in the file requires the above instruction to be nested within a further repetitive loop, such as:

(TC/JUNK/,(R/JUNK/FRED/).E,T1)E

The TC/JUNK/ is required to find initially each line containing JUNK.

Users should beware of getting the EDITOR into a loop by instruction repetition, due usually to the pointer not being moved after each repetition. For example:

(PO)E

is an obvious loop case. However consider:

(R/JUNK/FRED/)E

This replaces JUNK by FRED within the record until the end of file is reached. However, as the repetition never advances any records, this can never occur and the EDITOR will sit in a loop reporting that it cannot find JUNK by the message:

CHARACTER NOT FOUND

In this case, as in any other loop case, a break-in will stop the instruction at the point it has reached currently. Use of the F instruction will revert the edit to its state prior to the repetitive edit.

The instruction repetition facility has the limitation that multi-record insertions and the merge instructions cannot be repeated.

G.7 MERGE FILE Instruction - M

During an edit, it is possible to change the oldfile being used and thus merge different files into a single newfile. This is achieved by the EDITOR instruction:

M filename

This causes reading from the current oldfile to be suspended, the pointer remembered, and then filename to be used as oldfile from then on. Reading of the current oldfile is started at the beginning in the normal manner and the pointer is reset to 0.0 to indicate this. Editing instructions (including further M instructions up to a maximum of 9) can now be applied to this oldfile.

To close the current oldfile (that is obtain no more text from it) and return to the previous oldfile, the following instruction is given:

X

The previous oldfile is then reinstated as the source of text and the pointer reset to its value when the M instruction was given.

Note that, if an E instruction is given when a file is being merged, the EDITOR copies over the remainder of the file being merged, and then goes back to any previous oldfiles, copying them into newfile as well.

For example, suppose the user has a file FRED:

ABC 
JKL

If he has a second file JIM:

DEF 
GHI

Merging JIM into FRED after record ABC is achieved by the sequence:

CORRECT FRED 
T1,M JIM,TE,X,E

The file FRED would then be:

ABC 
DEF 
GHI 
JKL

If, however, only the second record of JIM was required, the editing instructions would be:

T1,M JIM,P1,T1,X,E

This generates FRED as:

ABC 
GHI 
JKL

G.8 ERROR MESSAGES

G.8.1 EDITING ERROR MESSAGES

There are very many error messages, most of which are self-explanatory. The most common are itemised below. Whenever an error occurs in an editing instruction and the pointer has been moved, recovery can be made by using the F instruction, except for certain errors in the U instruction which terminate the edit.

(1)   CHARACTER NOT  FOUND

T, A, B or R instruction specifies a non-existent character string in the current record. The pointer is left at the end of the record.

(2)  INSTRUCTION TERMINATED

If the BREAKIN key is pressed in the middle of the EDITOR executing an instruction, this message is given. The pointer position depends on how much of the instruction has been processed.

(3  SYNTAX ERROR

Invalid instruction, often because a string delimiter or comma has been omitted.

(4)  YOU'VE  RUN OFF THE END OF THE  FILE

The pointer has been moved off the end of the file, possibly through looking for a string which does not exist or going over too many records. The pointer is left at the end of the file.

G.8.2 ERROR MESSAGES FROM CORRECT

There are several possible messages generated by the CORRECT macro. The most common are:

ERROR IN PARAMETER 1 IN ED IN CORRECT : ENTRANT filename DOES NOT EXIST

This message occurs when either the filename is incorrect or the user is in the wrong directory.

There are some possible errors which will cause CORRECT to keep both oldfile and newfile and give a DISPLAY to this effect. These errors are usually the result of unusual occurrences during editing such as oldfile having its ERASE trap closed so that CORRECT cannot erase it.

For some errors (such as could be generated by the U instruction), CORRECT will also give the following DISPLAY:

DISPLAY : EDIT ENDED IN UNUSUAL ERROR!!!!!

A message prior to this will indicate the reason. CORRECT will also DISPLAY whether oldfile and newfile have been kept.

When CORRECT keeps both oldfile and newfile, the state of the file before the edit can be reinstated by simply erasing newfile. For example, for a file FRED:

ERASE  FRED

will erase the highest generation number of file FRED, which was newfile leaving oldfile as the new highest generation file which can then be CORRECTed again. Failure to erase newfile will cause CORRECT to pick up this as its oldfile on the next use.

The existence of one or more generations of a file can be ascertained from a LISTDIRECTORY output or by RETRIEVING the file as illustrated in the editing example. If the command:

RETRIEVE FRED(-1)

is given, an error indicates no oldfile exists; an affirmative reply indicates that both oldfile and newfile exist.

G.9 TECHNIQUES IN THE USE OF THE EDITOR

G.9.1 INTRODUCTION

This section shows some techniques on how to use the EDITOR and in some cases how to overcome its deficiencies (see also section on Instruction Repetition (G.6) and Forget Instruction (G.5.3)).

G.9.2 USE OF F AND L INSTRUCTIONS

The F instruction to forget the previous editing instructions and the L (listing) instruction give a very powerful tool for checking that the record written to newfile is correct. Consider the record:

982 IN=2

The user wants to change this to:

982 IN=2+N

If the pointer is initially at the beginning of the record, consider the instruction sequence:

R/2/2+N/,L,T1,L

This would give a listing of the record written to new file of:

982+N  IN=2

This is obviously wrong. To remedy the situation, the user should type in:

F

This reverts the pointer to its original position at the beginning of the record and the user can start again. The following sequence:

A/=2/+N/,L,T1,L 

gives a listing back of:

982 IN=2+N

This is correct and further editing can continue. However, if this is not so, another F instruction will permit further attempts at correcting the changes. Note that if the first F instruction has been given along with the corrected editing instructions, then no recovery from any error in these instructions is possible.

G.9.3 TRAILING SPACES IN RECORDS

When a file is input from a card deck, GEORGE removes the trailing spaces to make the file as compact as possible. Thus if a card contains:

  982 IN=2

This will be held as 10 characters in a file record, the remaining 70 spaces in the card being ignored. When such a record is read by a program, the spaces are added back to the file thus giving the impression of reading the actual card.

Unfortunately, in the EDITOR, the trailing spaces are never added back on to the record. Hence the instruction:

R/2  /2+N/

would fail in its attempt to make the record become:

  982  IN=2+N
  

as the record ends after the second character 2. One solution would be to use the A instruction:

A/=2/+N/

Trailing spaces inserted into records during editing are kept, however, as are trailing spaces after, for example, the removal of sequence numbers on a FORTRAN source file.

G.9.4 BLANK LINES

As with trailing spaces, blank lines are treated differently by the EDITOR in that they contain no characters at all and hence a search cannot be made with a T or P command. Whilst in most instances this is a tolerable feature, when a user wishes to remove blank lines from a file, it can be quite a problem and the following solution is recommended for this purpose.

The technique involves choosing a character that, does not occur in the file (for example #). A PC/#/ instruction which runs off the end of the file will confirm that it does not exist in the file. Then three CORRECT's of the file are needed as follows:

(1) Insert this character at the end of each line by the editing sequence:

(T.E,I/#/,T1)E,E

This will now mean that # is the only character on the blank line.

(2) Remove all lines starting with the character # by:

(TS/#/,P1)E,E

The TS is used to remove any blank lines inserted during editing which may contain spaces.

(3) Remove all the occurrences of the character # from the other records by:

(R/#//,T1)E,E

G.9.5 USE OF BREAK-IN DURING EDITS

There are several instances when a user wishes to stop the EDITOR obeying the editing instructions it is currently processing, for example, when an E instruction has been given on a large file with the Listing switch on, or instruction repetition has got into a loop. Depressing the BREAKIN key causes the EDITOR to suspend execution of the instructions, giving the message:

INSTRUCTION TERMINATED

It also gives the current pointer position of the oldfile; this is determined by how many of the editing instructions have been processed. It is recommended that an F instruction is then given which will recover from the error.

It should be noted that there is no way of continuing an instruction once BREAKIN has been issued (as in the case of a GEORGE macro) and there is no means of leaving the EDITOR other than by a Q or E instruction.

G.9.6 SELECTIVE EDITING FROM LARGE FILES

In cases where a user has a very large file and he wishes to select a small section from it to put into a second file, the most obvious way is to take a copy of the file and CORRECT out the unrequired sections. However, due to the PE instruction causing the EDITOR to scan the oldfile in order to find the record number, this can be a very slow process and a faster and more efficient method is to use the M instruction to merge the required information into the file.

The technique is that given a large file BIG and a requirement to have the first 200 records of BIG in a file LITTLE, the user first INPUTs a file LITTLE by:

INPUT LITTLE
****

Then CORRECT LITTLE and merge in the records from BIG as follows:

CORRECT  LITTLE
PE,MBIG
T200
X
E

The PE is to remove the **** from LITTLE. Now LITTLE contains the first 200 records of BIG. Other selections could be made from BIG in a similar manner.

G.10 ADDITIONAL FACILITIES IN CORRECT

G.10.1 INCLUSION OF LANGUAGE CODE

Users can specify a language code for the file to be edited by giving CORRECT the additional parameter of /languagecode. This is a means of keeping languagecode on a filename (as it would normally be lost in an edit), not of differentiating between files of the same name. CORRECT will edit the latest generation of the file and will give an error if the language code is not correct.

For example, if a user has a file FRED(21/LANG), he could issue the command:

CORRECT  FRED,/LANG

This will edit to a new file FRED(22/LANG). However, if the command given was:M

CORRECT FRED

this will edit to a new file FRED(22) , the language code being lost. Note that if the user had files FRED(21/LANG) and FRED(22) then the command CORRECT FRED would edit FRED(22) to FRED(23) and CORRECT FRED,/LANG would give an error because the latest file FRED(22) does not have the language code.

G.10.2 FAST EDITING

CORRECT edits from the named file to a workfile thus giving full security in a system failure of any nature because the user is always left with the original file, all the editing being lost. This incurs the overhead that the workfile must be copied to newfile after the edit. To avoid this overhead, users who are prepared to sort out the mess after a system failure during an edit, may edit direct to newfile by preceding the filename by a full stop. The effect of a system failure in this instance is indeterminate, but in general oldfile is always kept and possibly the partially edited newfile. Listing the directory or using the RETRIEVE command can be used to ascertain what files remain. For example, if the user has a file FRED(22), the following command could be issued:

CORRECT .FRED

This will edit to FRED(23). If the user has a file FRED(22/LANG) then he could give the command:

CORRECT .FRED,/LANG

which will edit to FRED(23/LANG).

G.10.3 SETTING TRAPS ON NEWFILE

An annoying feature of editing is the inability to carry trap settings from the old to the new file. This is in part mitigated by an enhancement to CORRECT which allows the user to set the traps on the newfile. This is achieved by the parameter + , which has two formats:

(1) +     :gives newfile the traps :MANAGER, GROUP, READ, EXECUTE  and is  
           intended for  files which  are  to be  accessed by  all  users.
(2) +(trap qualifiers): gives  newfile   the  traps :MANAGER, GROUP, READ, EXECUTE  
                        and is  intended for  files which  are  to be  accessed by  
                        all  users.

All files when created have all the traps open to the owner. Some examples are:

CORRECT   FRED,+ 
CORRECT  FRED,/TEST,+ 
CORRECT  FRED,+(:NTBE34,READ)

If there is an error in the trap qualifiers, then the action taken depends on the use of CORRECT. When used normally (ie CORRECT filename) then the error is not detected until after the edit is completed and the newfile is established. CORRECT attempts a TRAPGO on newfile and if this has an error in the qualifiers, this will give an error message from GEORGE and CORRECT will give the following display before ending:

TRAPS ERROR - TRAPS NOT  SET ON NEWFILE 

When CORRECT is used in the form:

CORRECT   .filename

then the error is detected at the beginning of the edit and GEORGE will give an error message and CORRECT aborts without any display (in the same manner as when a file does not exist).

G.11 THE EDIT COMMAND

G.11.1 THE FORMAT OF THE EDIT FILE

This is the GEORGE command which calls the EDITOR, and has the form:

EDIT oldfile,newfile,editfile

The parameters are:

oldfile  : the existing file to be edited from.
newfile  : the file produced as a result of the editing instructions being applied 
           to oldfile. If newfile is absent then the system generates a newfile 
           with the same name as oldfile but with its generation number increased 
           by one.
editfile : an optional file which, if present, instructs the EDITOR to obtain its 
           editing instructions from editfile (cf the U instruction).  If this 
           parameter is not present then the EDITOR takes its instructions from 
           the MOP terminal or job source in the same way as the CORRECT macro.

Use of the EDITOR is identical to its use under CORRECT (which uses the EDIT command to access the EDITOR), except that the user is now responsible for the files created by the EDITOR and for sorting out the files should a system break occur.

The following examples illustrate the use of the command:

EDIT FRED,JIM

This will edit file FRED into file JIM obtaining the editing instructions from the MOP terminal or job source. Note that the highest generation number of file FRED is used if more than one exists and that JIM will either overwrite the highest generation number of JIM or create a file of generation 1 if one does not already exist.

EDIT FRED

This will edit FRED into a filename FRED with a generation number one greater than FRED (as in CORRECT). Thus, if oldfile was FRED(9), then newfile would be FRED(IO). However, consider:

EDIT FRED(9),FRED(10)

This produces an identical effect. Editing instructions are again taken from the MOP terminal.

EDIT FRED,JIM,INSTRUCTIONS

This edits FRED into JIM using editing instructions obtained from the file INSTRUCTIONS which must contain an edit terminating instruction (E or Q).

G.11.2 THE EFFECT OF THE Q INSTRUCTION

When using the EDIT command, the abandonment of an edit by use of the Q instruction will normally cause newfile to be automatically erased as under CORRECT. However, if newfile existed prior to the edit and had been dumped, then the on-line version is erased and the dumped version retrieved automatically.

G.12 EDITING FROM BACKGROUND JOBS

It is strongly recommended that the EDIT rather than the CORRECT command is used for background jobs and that generation numbers are used when oldfile and newfile have the same names. This is to allow the job to be rerun in case of a system break and also to prevent a second run of the job corrupting the results of a first run.

For a background job, the editing instructions are obtained from the job source in an identical manner to the way in which they were obtained from the MOP terminal. Obviously, an editing error is not recoverable and when one is detected, the EDITOR gives the appropriate error message and simulates an E instruction, thus copying the remainder of oldfile to newfile. No erasure of either oldfile or newfile is made. An example of a background job might be that, given a file FRED which the user wishes to edit and compile, he might Have the job:

JOB TESTFRED,:NTBE34,JD(JT 30 SECS)
EDIT FRED,NEWFRED
T25,P1,I/X=Y+Z
/,E
TASK FORTRAN,*CR NEWFRED
EJ
****

If a system break occurred anywhere in the run, then a rerun would be successful.

Users should note that the EDITOR obtains its instructions from the job source and hence the editing instructions cannot be put in a macro. This problem can be overcome by putting the instructions in a file and using this as an editfile for the EDIT command. For example, if file MYEDIT contained:

EDIT FRED,NEWFRED 
T25,P1,I/X=Y+Z
/,E

If the user submitted a job:

JOB TESTFRED,:NTBE34,JD(JT 30 SECS)
MYEDIT
TASK FORTRAN,*CR NEWFRED
EJ
****

then the job would fail as the EDITOR would read its instructions from the #job source, reading TASK as the first EDITOR instruction.

If the editing instructions alone were put in a file MYEDIT, the job would then be correct if it was of the form:

JOB TESTFRED,:NTBE34,JD(JT 30 SECS) 
EDIT FRED,NEWFRED,MYEDIT 
TASK FORTRAN,*CR NEWFRED 
EJ
****

G.13 SUMMARY OF EDITOR INSTRUCTIONS

Instruction                       Format
After                             A/oldstring/newstring/

Inserts newstring after oldstring.

The current record is transcribed up to and including oldstring and then newstring is written to newfile. The finishing point is the character after oldstring.


Before                             B/oldstring/newstring/

Inserts newstring before oldstring.

The current record is transcribed up to but not including oldstring and then newstring is written to newfile.


Dummy                           Dch

Character ch acts as a dummy in strings.

When the EDITOR is searching for a specified character string, a character .ch may be nominated as a dummy symbol to represent any character when it appears between string delimiters. The command can be used more than once. Typing D by itself will indicate no dummy character is required.


End                             E

Ends the edit.

The remainder of oldfile is transcribed to newfile, all files are closed and the edit is ended.


Forget                            F

Cancels previous editing record.

The record of editing instructions immediately before this one is cancelled. Any information written to newfile as a result of the incorrect instruction will be erased. The pointer is put back to where it was before the incorrect instruction was obeyed. Two consecutive F instructions are not allowed.


H                                 H# octno (where octno is a one or two digit octal number)

This causes the PFCC on records subsequently written to newfile to be set to octno. Typing H by itself cancels the nominated PFCC value and causes the PFCC values in oldfile to be used.


Insert                             I/newstring

Inserts newstring before current position.

If newstring is a single record, it will be written to newfile within the current record. If newstring is several lines, a newfile record will be written for each newstring line that is input. The delimiter (/) is output before the invitation to type for each line. The pointer position is unchanged.


List                             L ON 
                                 L OFF 
                                 L

Sets state of listing switch.

If a listing of newfile is required, the listing must be set on. Typing L by itself reverses the current setting.


Merge                           M filename

Causes filename to be used as oldfile.

The current oldfile will be changed to filename. The pointer to the previous oldfile is remembered and is then reset to 0.0 before filename is opened.


Number                             N ON 
                                   N OFF 
                                   N

Sets state of numbering switch.

If the numbering switch is on, each record in the listing of newfile is numbered. The listing switch must also be on. Typing N by itself reverses the current setting.


Origin                           O decno 
                                 O#

Causes the number of the current record in oldfile to be set to decno (or zero if decno is omitted). The second format of this instruction causes the numbering of the records in oldfile to be reset so that the first record in the file (ie record 0) is numbered 0.


Position                           P endpoint

Moves pointer to endpoint.

The pointer is moved to endpoint and no information is written to newfile.


Quit                             Q

Abandons the edit.

All files are closed, the edit is abandoned and EDIT ABANDONED is output.


Replace                           R/oldstring/newstring/

Replaces oldstring by newstring.

The current record is transcribed up to but not including oldstring. Then newstring is written to newfile and the pointer is moved past oldstring.


Transcribe                        T endpoint

Transcribes from oldfile to newfile.

Information is transcribed to newfile starting at the current position of the pointer and ending at the character before endpoint. The final pointer position is after the character before endpoint.


Use                             U filename

Editing instructions read from filename.

Subsequent editing instructions are read from filename. It must be the last or only instruction on a line. If no filename is given, subsequent instructions are read from the MOP terminal.


Visible                             Vch

Spaces can be typed as ch in strings.

The character ch can be typed in place of space in strings. Typing V by itself will indicate that no visible space character is required. Space itself will always be interpreted as space.


Window                             W ON
                                   W OFF 
                                   W

Set state of window switch.

If the window switch is on, the current record of the oldfile will be output to the MOP terminal each time the pointer is moved to a new record. Typing W by itself reverses the current setting.


X                                 X

Revert to previous oldfile.

Subsequent editing instructions will refer to the oldfile being used before the last Merge instruction. The pointer will be reset to its previous position in this oldfile.


Z                                 Z

Revert to previous editing file.

Subsequent editing instructions will be read from the file that was current before the last Use instruction.

⇑ Top of page
© Chilton Computing and UKRI Science and Technology Facilities Council webmaster@chilton-computing.org.uk
Our thanks to UKRI Science and Technology Facilities Council for hosting this site