HP 3000 Manuals

INSERT [ EDIT/3000:Reference Manual ] MPE/iX 5.0 Documentation


EDIT/3000:Reference Manual

INSERT 

3-50.  INSERT COMMAND 

3-51.  Purpose. 

The INSERT command inserts character strings or lines of text into the
WORK file at a specified position, irrespective of line boundaries.

3-52.  Form. 

The form of the INSERT command is

                       [{BY}            ]
I[NSERT][Q] [position] [{, } [increment]] [,] [HOLD[Q] [,] [NOW]]

3-53.  Description. 

The INSERT command is used to insert character strings in a line of text
in the WORK file or to insert complete lines of text in the WORK file.

In an interactive session, EDIT/3000 prompts by displaying the line
number referenced in the position parameter and the contents of the line,
then displays an arrow under the column, if a column was specified in the
position parameter.  (If the Q parameter is included in the INSERT
command the prompt is not displayed.)  A specific column in a line is
specified in the position parameter by enclosing the column number in
parentheses.  For example,

     * INSERT 5(10)

references the 10th column of line 5.

If no column is specified, as in INSERT 5, the leftmost column is assumed
by EDIT/3000 as determined by the SET LEFT = colnum option in effect
(default = column 1).  If a column number that is outside the SET LEFT,
SET RIGHT options in effect is specified, the INSERT command will not
execute and EDIT/3000 will display an error message.  (See paragraph 3-92
for a discussion of the SET command.)  If the text generated using an
INSERT command consists of more characters than are allowed in a line,
new lines are created by EDIT/3000 to accommodate the excess characters
(and the existing line).  In this case, the Editor attempts to break the
line at a blank character.  New line numbers are determined by the SET
DELTA = increment option in effect.  The SET DELTA option can be
overridden with the BY increment (or,increment) parameter of the INSERT
command.

If new lines are being inserted before a particular line in the WORK
file, the insert command saves that line.  This saved line is then added
after the new lines, once control Y has been pressed (see example 2
below).  If the SET DELTA-increment option in effect (or the BY increment 
parameter) does not allow enough new line numbers to be added when new
lines are being inserted, EDIT/3000 will insert new lines until it can no
longer add new line numbers, then terminate the INSERT mode and print an
error message, as well as the saved line which was lost from the work
file.  See the example of this in paragraph 3-55.

In an interactive session, the INSERT command may be terminated with
CONTROL Y or // in any one of four ways:

   1.  Press CONTROL Y after the last character has been inserted and
       before RETURN is pressed, as follows:

                 1      LINE 1 OF WORK FILE
                 2      LINE 2 OF WORK FILE
                 3      LINE 3 OF WORK FILE
                 4      LINE 4 OF WORK FILE
                 5      LINE 5 OF WORK FILE
            /INSERT 2                                      |--- YC 
                 2      LINE 2 OF WORK FILE                v
                        ^CONTROL Y  IS PRESSED BEFORE RETURNLINE 2 OF WORK FILE
            /LIST 2/3
                 2      CONTROL Y IS PRESSED BEFORE RETURNLINE 2 OF WORK FILE
                 3      LINE 3 OF WORK FILE

       The characters are inserted on the same line as the line specified
       (2) in the position parameter.  No characters will be moved to the
       next line unless more characters are inserted than the length of
       the line can accept.

   2.  Press CONTROL Y after the last character has been inserted and
       after RETURN is pressed, as follows:

            /INSERT   3
                  3   LINE  3 OF WORK FILE
                      ^CONTROL Y is PRESSED AFTER RETURN  CR  YC 
                  3.1 LINE 3 OF WORK FILE
            /LIST 3/4
                  3   CONTROL Y is PRESSED AFTER RETURN
                  3.1 LINE 3 OF WORK FILE
                  4   LINE 4 OF WORK FILE

       The text to be inserted replaces the line specified in the
       position parameter and the text previously contained in this line
       is given a new line number.  Thus, the INSERT command caused a new
       line to be inserted before an existing line.

   3.  Enter // after the last character has been inserted and before
       RETURN is pressed, as follows:

            /INSERT  3
                  3  LINE 3 OF WORK FILE
                      // IS ENTERED BEFORE RETURN //   CR 
            LINE 3 OF W0RK FILE
            /LIST 3/4
                  3  // IS ENTERED BEFORE RETURN LINE 3 OF WORK FILE
                  4  LINE 4 OF WORK FILE

       Entering // in this manner has the same effect as that described
       for CONTROL Y in example 1.

   4.  Enter // after the last character has been inserted and after
       RETURN is pressed, as follows:

            /INSERT  1
                  1  LINE 1 OF WORK FILE
                     ^// IS ENTERED AFTER RETURN   CR 
                  1.1 //
            LINE 1 OF WORK FILE
            /LIST, 1/2
                  1  // IS ENTERED AFTER RETURN
                  1.1 LINE 1 OF WORK FILE
                  2  LINE 2 OF WORK FILE

       Entering // in this manner has the same effect as that described
       for CONTROL Y in example 2.

In batch mode, only // may be used either as the last two characters in a
line of characters to be inserted or as the only two characters in a
record.  The results are the same as shown in the preceding examples 3
and 4.

3-54.  Limitations. 

Text can only be inserted in a line beginning at a column within the SET
LEFT, SET RIGHT margins established for that line.  An existing line
number must be specified in the position param- eter for the INSERT
command (unlike the ADD command, which can specify ADD 5.1 to insert the
line 5.1 between the existing lines 5 and 6).

3-55.  Examples. 

The following examples show several variations of the INSERT command.
The location of the pointer is illustrated after the conclusion of each
INSERT command.

 *  INSERT linenumber 

The following example illustrates how to insert a line into the WORK
file.  To insert a new line before line 7, the command INSERT 7 is used.
EDIT/3000 prompts with the number 7 and the new line is entered and
RETURN is pressed.  When 7.1 is displayed by EDIT/3000, // is entered.
The pointer is located at the first position of line 7.1, which is the
old line 7.

The LIST 6/8 command shows the positions of the inserted line and the
previous line 7.

     /LIST ALL
             1     1-2. WHAT IS EDIT/3000?
             2
             3     EDIT/3000 IS A SUBSYSTEM OF THE HP 3000
             4     MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
             5     (MPE/3000) THAT IS USED TO CREATE AND
             6     MANIPULATE ASCII FILES.
             7
             8     CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE
             9     LINES OF CHARACTERS CAN BE INSERTED, DELETED,
            10     REPLACED, MODIFIED, SEARCHED FOR, AND OTHERWISE
            11     MANIPULATED BY USING EDIT/3000 COMMANDS.
     /INSERT  7
             7
                   ^ (EDIT/3000 COMMANDS ARE USED.)
             7.1   //

     /FIND*
             7.1
                   ^ (0)
     /LIST 6/8
             6     MANIPULATE ASCII FILES.
             7     (EDIT/3000 COMMANDS ARE USED.)
             7.1
             8     CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE

The following example illustrates the error message which is printed if
the SET DELTA=increment option in effect does not allow new line numbers
when new lines are being inserted.  TEST is listed and INSERT 1.998 is
used to insert two new lines.  A carriage return is pressed after each
line.  Since the SET DELTA= increment option does not allow any more new
line numbers, a warning message is printed out, as well as the saved line
(the line originally on line 1.998) which is now lost from the WORK file.

     /T TEST
     /LIST ALL
     1        THIS IS LINE ONE
     1.998    THIS IS A LINE INBETWEEN
     2        THIS IS LINE TWO
     /INSERT 1.998
     1.998    THIS IS A LINE INBETWEEN
              ^ABCDEFGHIJKLMNOP
     1.999    123456789
     ****WARNING - LINE BROUGHT FORWARD LOST:
     THIS IS A LINE INBETWEEN
     *15*COMMAND WILL NOT REPLACE OR INTERLEAVE LINES
     /LIST ALL
     1        THIS IS LINE ONE
     1.998    ABCDEFGHHIJKLMNOP
     1.999    123456789
     2        THIS IS LINE TWO
     /END
     IF IT IS OK TO CLEAR RESPOND "YES"
     CLEAR? YES

 *  INSERT colnum

To insert text before a position in a line, the position number is
specified in parentheses as shown in the next example.

The text (HELD,) is entered and // is entered before RETURN.

     /INSERT 10(20)
             10          REPLACED, MODIFIED, SEARCHED FOR, AND OTHERWISE
                                            ^ HELD, //
        SEARCHED         FOR, AND OTHERWISE
     /FIND *
             10         REPLACED, MODIFIED, HELD, SEARCHED FOR, AND OTHERWISE
                                                 ^ (27 )
     /LIST 10/11
             10         REPLACED, MODIFIED, HELD,SEARCHED FOR, AND OTHERWISE
             11         MANIPULATED BY USING EDIT/3000 COMMANDS.

 *  SPLITTING A LINE INTO TWO LINES

If you wish to make two lines out of an existing line, use the INSERT
command as shown in the following example.

The FINDQ FIRST;FIND "OPERATING" commands locate the desired position
where the line is to be split.

Entering the INSERT 4(28) command and then //after RETURN creates a new
line (4.1) and the previous line 4 is now two lines.

     /FINDQ FIRST;FIND "OPERATING"
         4      MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
                                          ^ (28)
     /INSERT 4 (28)
         4      MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
                                          ^
         4.1    //
     OPERATING SYSTEM
     /LIST 4/5
         4      MULTIPROGRAMMING EXECUTIVE
         4.1    OPERATING SYSTEM
         5      (MPE/3000) THAT IS USED TO CREATE AND

Another way to accomplish the same thing is to use the FIND "OPERATING"
and INSERT * commands, then enter // after RETURN. For example

     /FINDQ FIRST;FIND "OPERATING"
         4     MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
                                         ^ (28)
     /INSERT *
         4      MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
                                          ^
         4.1    //
     OPERATING SYSTEM
     /LIST 4/5
         4      MULTIPROGRAMMING EXECUTIVE
         4.1    OPERATING SYSTEM
         5      (MPE/3000) THAT IS USED TO CREATE AND

 *  INSERT linenumber, HOLD

When the INSERT linenumber, HOLD form of the INSERT command is used, text
is entered from the input file and, when the end of this text is
signalled, the contents of the HOLD file are inserted.

Note from the example below that EDIT/3000 compresses the contents of the
HOLD file by adding words from the next record to the current record.
(The word "LINES" from the second record is added to the end of the first
record, and "REPLACED" from the third record is added to the end of the
second record.)  When- ever an insertion from the HOLD file is made, it
is similar to a justification process.  The EDITOR tries to fill out
lines with words up to the RIGHT margin.  If the line is longer than the
value of the RIGHT parameter, the EDITOR breaks it at a blank and inserts
the remainder on the next line.  If the new line becomes full, the EDITOR
breaks it to continue on the next line and so forth.  If the HOLD file
contains a blank line, it causes the current line to be completed but no
blank line is inserted into the work file.  Insertion would then continue
to the next line.  If the HOLD file has two blank lines, only one blank
line gets inserted.  If the HOLD file has three blank lines, 2 blank
lines are inserted and so on.

The original line 5 start sat the end of the last HOLD file record.  (The
string (MPE/3000)from the original line 5 is appended to the end of the
last HOLD file record entered into the WORK file.)

     /LIST ALL
           1      1-2.  WHAT IS EDIT/3000?
           2
           3      EDIT/3000 IS A SUBSYSTEM OF THE HP 3000
           4      MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
           5      (MPE/3000) THAT IS USED TO CREATE AND
           6      MANIPULATE ASCII FILES.
           7
           8      CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE
           9      LINES OF CHARACTERS CAN BE INSERTED, DELETED,
          10      REPLACED, MODIFIED, SEARCHED FOR, AND OTHERWISE
          11      MANIPULATED BY USING EDIT/3000 COMMANDS.
     /HOLD 8/10
     HOLD FILE LENGTH IS 3 RECORDS
     /INSERTQ 5, HOLDQ
     ^ (MPE/3000) THAT IS USED TO CREATE AND
      THE HOLD FILE CONTENTS WILL BE INSERTED
     AFTER TEXT FROM THE TERMINAL IS ENDED
     BY ENTERING DOUBLE SLASH OR CONTROL Y.
     //
     CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE LINES
     OF CHARACTERS CAN BE INSERTED, DELETED, REPLACED,
     MODIFIED, SEARCHED FOR, AND OTHERWISE (MPE/3000)
     THAT IS USED TO CREATE AND
     /LIST 5/6
              5          THE HOLD FILE CONTENTS WILL BE INSERTED
              5.1        AFTER TEXT FROM THE TERMINAL IS ENDED
              5.2        BY ENTERING DOUBLE SLASH OR CONTROL Y.
              5.3        CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE LINES
              5.4        OF CHARACHERS CAN BE INSERTED, DELETED, REPLACED
              5.5        MODIFIED, SEARCHED FOR, AND OTHERWISE (MPE/3000)
              5.6        THAT IS USED TO CREATE AND
              6          MANIPULATE  ASCII FILES.
     /E

 *  INSERT linenumber, HOLD, NOW

When this form of the INSERT command is used, the HOLD file contents are
inserted before the line specified in the linenumber parameter and no
text is inserted from the input file first (as it was in the previous
example).

Note that the HOLD file contents, however, are compressed the same as in
the previous example.

     /LIST ALL
            1      1-2.  WHAT IS EDIT/3000?
            2
            3      EDIT/3000 IS A SUBSYSTEM OF THE 3000
            4      MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
            5      (MPE/3000) THAT IS USED TO CREATE AND
            6      MANIPULATE ASCII FILES.
            7
            8      CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE
            9      LINES OF CHARACTERS CAN BE INSERTED, DELETED,
           10      REPLACED. MODIFIED, SEAPCHED FOR, AND OTHERWISE
           11      MANIPULATED BY USING EDIT/3000 COMMANDS.
     /HOLDQ  8/10
     HOLD FILE LENGTH IS 3 RECORDS
     /INSERTQ 5,HOLDQ,NOW
     CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE LINES
     OF CHARACTERS CAN BE INSERTED, DELETED, REPLACED,
     MODIFIED, SEARCHED FOR, AND OTHEWISE (MPE/3000)
     THAT IS  USED TO CREATE AND
     /LIST 5/6
            5      CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE LINES
            5.1    OF CHARACTERS CAN BE INSERTED, DELETED, REPLACED,
            5.2    MODIFIED, SEARCHED FOR, AND OTHERWISE (MPE/3000)
            5.3    THAT IS USED TO CREATE AND
            6      MANIPULATE ASCII FILES.


MPE/iX 5.0 Documentation