HPlogo EDIT/3000 Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 3 EDIT/3000 COMMANDS

ADD

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

3-8. ADD COMMAND

3-9. Purpose.

The ADD command is used to enter text into the WORK file from an INPUT file or from the HOLD file.

3-10. Form.

The form of the ADD command is

     A[DD][Q] [linenumber] [,HOLD[Q] [,NOW] ]

3-11. Description.

The ADD command can add text to the WORK file from an input file or from the HOLD file. The command adds text between existing lines of text in the WORK file by declaring a specific linenumber in the ADD command, or to the end of the WORK file if linenumber is absent. If an asterisk is entered as the linenumber, text will be added immediately following the line on which the pointer is situated. The new linenumber is determined in the same way as in the example above.

3-12. Limitations.

The ADD command cannot be used to replace existing lines of text in the WORK file. For example, if line 5 already exists in the WORK file, the command ADD 5 will cause the text to be added between line 5 and the line following it.

If the linenumber parameter is absent from the ADD command and the WORK file is empty, text begins at the line specified by the SET FROM = linenumber command (default = 1). The left and right margins are set by the SET LEFT = colnum and SET RIGHT = colnum commands. See paragraph 3-92 for a description of the SET command.

3-13. Examples.

Examples are provided for several variations of the ADD command. The position of the pointer for each variation is shown in these examples.

  • ADD

In the following example, the ADD command adds text records to the end of the WORK file. (The text begins at line 1 in the example because the WORK file is empty and SET FROM is equal to the default value of 1.)

EDIT/3000 prompts with line numbers and text is added. Two slashes ( // ) are used to terminate the ADD command. The ADD command also can be terminated by CONTROL Y in an interactive session.

The FIND* command (see paragraph 3-32) locates the pointer, which is set to position 1 of the last record entered. EDIT/3000 prints the last line entered, an arrow, and the column number (position) in parentheses. Thus, the pointer is at the first character of the last line entered. Note that the line number is not considered to be part of the record. Note also that when another ADD command is entered, the pointer will be incremented so that text will be added beginning with the next line (line 5 in this example).

   /ADD

       1     1-1. WHAT IS EDIT/3000?

       2     EDIT/3000 IS A SUBSYSTEM OF THE HP 3000

       3     MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM

       4     (MPE/3000) THAT IS USED TO CREATE AND

       5     //

    ...

   /FIND*

       4     (MPE/3000) THAT IS USED TO CREATE AND

             ^(1  )
  • ADDQ

When the ADDQ command is used, as in the following example, EDIT/3000 does not prompt with line numbers. Text is added as before, and CONTROL Y or // is used to terminate the command.

   /ADDQ

   MANIPULATE ASCII FILES.

   CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE

   LINES OF CHARACTERS CAN BE INSERTED, DELETED,

   BY USING EDIT/3000 COMMANDS.

   //

   ...

   /FIND*

       8     BY USING EDIT/3000 COMMANDS.

             ^(1  )
  • ADD linenumber

If the linenumber parameter is part of the ADD command, a specific line number is added to the WORK file. Line number 7.1 is added between lines 7 and 8 in the following example.

   /LIST 7/8

       7    LINES OF CHARACTERS CAN BE INSERTED, DELETED,

       8    BY USING EDIT/3000 COMMANDS.

   /ADD 7.1

       7.1  REPLACED, MODIFIED, AND SEARCHED FOR

       7.2  //

   ...

   /FIND*

       7.1  REPLACED, MODIFIED, AND SEARCHED FOR

            ^(1 )

   /LIST 7/8

       7    LINES OF CHARACTERS CAN BE INSERTED, DELETED,

       7.1  REPLACED, MODIFIED, AND SEARCHED FOR

       8    BY USING EDIT/3000 COMMANDS.
  • ADD,HOLD

The ADD, HOLD command adds text to the WORK file from an input file, then, after input from this file is terminated with // or CONTROL Y, the command adds text from the HOLD file.

In the following example, lines 9 and 10 are added from the terminal, input is terminated with //, and lines 11 and 12 are added from the HOLD file. (The HOLD file had been created previously with the HOLD command, described in paragraph 3-44.) The pointer is located at position 1 of the last line entered from the HOLD file.

(If the ADD,HOLDQ form of the command had been used, the HOLD file contents added (lines 11 and 12) would not have been listed.)

   /ADD,HOLD

      9    THE FILES TO BE EDITED CAN BE SOURCE PROGRAMS

     10    WRITTEN IN COMPUTER LANGUAGE SUCH AS FORTRAN

     11    //

   ...

     11    AND COBOL, OR TEXT MATERIAL SUCH AS LETTERS,

     12    REPORTS, TECHNICAL MANUALS, AND SO FORTH.

   ...

   /FIND*

     12    REPORTS, TECHNICAL MANUALS, AND SO FORTH.

           ^(1  )
  • ADD,HOLD,NOW

The ADD,HOLD,NOW command adds text to the WORK file from the HOLD file only, as shown in the following example. (Note that a new HOLD file has been created.)

   /ADD,HOLD,NOW

      13     1-2.  EDIT/3000 FEATURES

      14     WITH EDIT/3000, IT IS POSSIBLE TO

      15     CREATE AND BUILD A NEW FILE (CALLED A WORK FILE)

      16     BY ENTERING COMMANDS AND LINES OF TEXT FROM AN

   ...

   /FIND*

      16     BY ENTERING COMMANDS AND LINES OF TEXT FROM AN

             ^(1 )
  • ADD,HOLDQ,NOW

The ADD,HOLDQ,NOW command adds text to the WORK file from the HOLD file without listing the text added. Instead, EDIT/3000 displays the message LAST LINE = linenumber, where linenumber is the last line added from the HOLD file. In this case, it happens to be the last line in the WORK file. The HOLD file used in this example is the same as that used in the previous example.

   /ADD,HOLDQ,NOW

   ...

   LAST LINE =    16

   /FIND*

      16       BY ENTERING COMMANDS AND LINES OF TEXT FROM AN

               ^(1 )
  • ADD linenumber,HOLD,NOW

When the ADD linenumber,HOLD,NOW variation of the ADD command is used, the HOLD file contents are added to the WORK file beginning at the line number specified by the linenumber parameter.

In the following example, four lines of text are added to the WORK file starting at line 12 (the lines are inserted between lines 12 and 13 of the WORK file). A listing of the complete WORK file shows the result of the various ADD commands.

   /ADD 12.1,HOLD,NOW

      12.1   1-2.  EDIT/3000 FEATURES

      12.2   WITH EDIT/3000, IT IS POSSIBLE TO

      12.3     CREATE AND BUILD A NEW FILE (CALLED A WORK FILE)

      12.4     BY ENTERING COMMANDS AND LINES OF TEXT FROM AN

   ...

   /FIND*

      12.4     BY ENTERING COMMANDS AND LINES OF TEXT FROM AN

               ^(1 )

   /LIST ALL

       1     1.1  WHAT IS EDIT/3000?

       2     EDIT/3000 IS A SUBSYSTEM OF THE HP 3000

       3     MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM

       4     (MPE/3000) THAT IS USED TO CREATE AND

       5     MANPULATE ASCII FILES.

       6     CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE

       7     LINES OF CHARACTERS CAN BE INSERTED, DELETED,

       7.1   REPLACED, MODIFIED, SEARCHED FOR, AND

       7.2   OTHERWISE MANIPULATED

       8     BY USING EDIT/3000 COMMANDS.

       9     THE FILES TO BE EDITED CAN BE SOURCE PROGRAMS

      10     WRITTEN IN COMPUTER LANGUAGE SUCH AS FORTRAN

      11     AND COBOL, OR TEXT MATERIAL SUCH AS LETTERS,

      12     REPORTS, TECHNICAL MANUALS, AND SO FORTH.

      12.1   1-2.  EDIT/3000 FEATURES

      12.2   WITH EDIT/3000, IT IS POSSIBLE TO

      12.3     CREATE AND BUILD A NEW FILE (CALLED A WORK FILE)

      12.4     BY ENTERING COMMANDS AND LINES OF TEXT FROM AN

      13       INPUT FILE AND/OR FROM A SPECIAL DISC FILE

      14       (CALLED A HOLD FILE).

If ADD linenumber, HOLDQ,NOW is specified, only the number of the last line added from the HOLD file is displayed.

Feedback to webmaster