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

USE

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

3-104. USE COMMAND

3-105. Purpose.

The USE command designates a file (USE file) to be used by EDIT/3000 as a source of commands and/or text.

3-106. Form.

The form of the USE command is

    U[SE] [filename]

3-107. Description.

The USE command causes EDIT/3000 to read commands from the USE file. In an interactive session, commands are read from the USE file, but any messages or requests for text records to be entered from the terminal are displayed on the terminal.

A USE command without the filename parameter functions as a return statement from the current EDIT/3000 USE command file in the same way that an end of data indication does. Note, however, that because the USE command will not be recognized if the FLAG is false (in a WHILE block for example, see Section IV), this type of return (unlike the end of data indication) is conditional. Thus, this conditional return may be used to write recursive EDIT/3000 command files. In batch mode, EDIT/3000 reads commands from the USE file but no interaction with the user occurs. Any text records can be in the USE file, or the USE file can transfer control to another file (INPUT or HOLD) to read the records. It is recommended that the Q command (see paragraph 3-80) be used in a USE file to remind you (or another user) of the purposes of the USE file. Text records can be included in a USE file and will be interpreted as such if the SET BATCH command is used. This allows you to operate in an interactive session in full batch mode (with text records following commands in the USE file). This option is useful when the same commands and text records are to be used in many positions in the WORK file.

A USE file may contain comments wherever a command may appear but not embedded in a command. A comment must begin with two adjacent less-than signs (<<) and end with two adjacent greater-than signs (>>). For example, a USE file may contain:

        TEXT EDITFILE

        FINDQ FIRST;"#" ; <<LOCATE LINE TERMINATED WITH #>>

        LIST

3-108. Limitations.

Any file to be read as a USE file must contain ASCII-coded records and must have a filecode between 0 and 1023. (See the MPE Commands Reference Manual for a discussion of filecode.)

The USE file should be kept unnumbered unless the commands are terminated with a semicolon, which signals to EDIT/3000 that the line number is not part of the command.

END in a USE file causes the USE command to terminate; the USE file is exited and EDIT/3000 prompts you with its usual slash. Note that END as the final line in a USE file is of no consequence — whereas if END appears anywhere else in the USE file, the lines following it are not executed.

3-109. Examples.

Two examples are shown to illustrate the USE command and USE files.

  • READING COMMANDS FROM A USE FILE

The USE file (USEFILE) in the following example contains the commands TEXT, CHANGE, FIND, MOD- IFY, and LIST. The command END is added later.

When the command USE USEFILE is entered, ED IT/3000 copies the file TEST into the WORK file, changes "EDIT/3000" to "HP 3000 TEXT EDITOR" for all occurrences of EDIT/3000, finds the first line, then searches forward from there to find the string "ASCII". The line (line 6) containing "ASCII" is displayed for modification and the characters "-CODED" are inserted. EDIT/3000 then lists the contents of the WORK file. When END is added in line 2.1 of USEFILE, the commands which follow line 2.1 are not executed when the USE command is used,

       1      TEXT TEST

       2      CHANGE "EDIT/3000" TO "HP 3000 TEXT EDITOR" IN ALL

       3      FINDQ FIRST;FIND "ASCII"

       4      MODIFY *

       5      LIST ALL

       6      //

   ...

   /KEEP USEFILE,UNN

   /USE USEFILE

       1      1-2. WHAT IS HP 3000 TEXT EDITOR?

       3      HP 3000 TEXT EDITOR IS A SUBSYSTEM OF THE HP3000

       6      MANIPULATE ASCII FILES.

                    (12)

   MODIFY         6

   MANIPULATE ASCII FILES.

                   I-CODED

   MANIPULATE ASCTI-CODED FILES.



       1      1-2. WHAT IS HP 3000 TEXT EDITOR?

       2

       3      HP 3000 TEXT EDITOR IS A SUBSYSTEM OF THE HP3000

       4      MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM

       5      (MPE/3000) THAT 1S USED) TO CREATE AND

       6      MANIPULATE ASCII-CODED FILES.

   /T USEFILE

   IF IT IS OK TO CLEAR RESPOND "YES"

   CLEAR? YES

    FILE UNNUMBERED

   /ADD 2.1

       2.1   END

       2.2   //

   ...

   /K USEFILE,UNN

   USEFILE ALREADY EXISTS - RESPOND YES TO PURGE OLD AND THEN KEEP

   PURGE OLD?YES

   /USE USEFILE

       1     1-2. WHAT 15 HP 3000 TEXT EDITOR?

       3     HP 3000 TEXT EDITOR IS A SUBSYSTEM OF THE HP3000

   /
  • READING COMMANDS AND TEXT FROM A USE FILE

USEFILE2, shown in the following example, contains the commands TEXT EDIT2, ADD, then 9 lines of text (including blank lines) to be added. The characters // signify the end of the text records.

NOTE: If the USEfile is prepared using the EDIT/3000 ADD command, EDIT/3000 will interpret // as the end of the ADD command. To overcome this, enter //, then a blank character before RETURN so that line 13 (LIST ALL) can be added. When the USE file commands are executed, the blank character following // will be ignored.

Before the USE USEFILE2 command is entered, the SET BATCH command is entered to inform EDIT/3000 that the USE file contains text records.

EDIT/3000 copies the contents of file EDIT2 into the WORK file by executing the TEXT command, lists the lines that were added to EDIT2, executes the LIST ALL command, then saves the WORK file contents by executing the KEEP EDIT3 command.

        1     TEXT EDIT2

        2     ADD

        3

        4     1-2. EDIT/3000 FEATURES

        5

        6     WITH EDIT/3000, IT IS POSSIBLE TO

        7

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

        9     BY ENTERING COMMANDS AND LINES OF TEXT FROM THE

        10    STANDARD INPUT DEVICE OR FROM A SPECIAL DISC FILE

        11    CALLED THE HOLD FlLE.

        12    //

        13    LIST ALL

   /KEEP USEFILE2,UNNUMBERED

   /SET BATCH

   /USE USEFILE2

        12

        13    1-2. EDIT/3000 FEATURES

        14

        15    WITH EDIT/3000, IT IS POSSIBLE TO

        16

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

        18    BY ENTERING COMMANDS AND LINES OF TEXT FROM THE

        19    STANDARD INPTUT DEVICE OR FROM A SPECIAL DISC FILE

        20    CALLED THE HOLD FILE.

   ...

        1     1-1. 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.

        12

        13    1-2.  EDIT/3000 FEATURES

        14

        15    WITH EDIT/3000, IT IS POSSIBLE TO

        16

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

        18    BY ENTERING COMMANDS  AND LINES OF TEXT FROM THE

        19    STANDARD INPUT DEVICE OR FROM A SPECIAL DISC FILE

        20    CALLED THE HOLD FILE.

   /KEEP EDIT3
Feedback to webmaster