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

OR

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

4-19. OR COMMAND

4-20. PURPOSE

The OR command sets the flag true if the flag is false. If the flag is true, both the OR command and the command immediately following it are skipped.

4-21. FORM

The form of the OR command is

        O[R]

4-22. DESCRIPTION

In the following example

   FINDQ FIRST

   WHILE

       FIND "EDIT/3000"(+9)

       BEGIN

          FIND "HP 3000"/*(+20)

          OR

          BEGIN

              CHANGE "HP3000" TO "HP 3000"

              END

   END

   

the command FIND "EDIT/3000" (+9) finds the string "EDIT/3000". Next, the BEGIN and FIND "HP 3000"/*(+20) commands locate the string "HP 3000" if it is within 20 character positions of the end of the first string. If the string "HP 3000" is found, the flag is true and the OR command and the next BEGIN-END pair are skipped. (If the command immediately following an OR command is a BEGIN command to start a series of commands within a BEGIN-END pair, the entire BEGIN-END block (including any other BEGIN-END blocks it may contain is skipped.)

If the flag is false, the OR command sets it to true and the BEGIN-END block is executed, changing "HP3000" to "HP 3000".

4-23. LIMITATIONS

The OR command should be used only with a WHILE block.

4-24. EXAMPLES

The WORK file is shown below.

   /S SHORT;T EDIT3;L 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.

      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.

      21

      22     SAVE THE WORK FILE INTO A PERMANENT FILE CALLED

      23     THE TEXT FILE.

      24

      25     CALL THE TEXT FILE BACK INTO THE WORK FILE FOR

      26     FURTHER ADDITIONS AND/OR EDITING.

      27

      28     CHANGE ALL OCCURENCES OF A CHARACTER STRING WITH

      29     ONE COMMAND.

      30

      31     DELETE CHARACTERS AND LINES FROM THE WORK FILE.

   

The following example illustrates the OR command usage.

The first FIND command after the WHILE finds the string "EDIT/3000" and positions the pointer one character beyond the last character in the string.

If the second FIND command fails, the flag is set to false. The OR command sets the flag to true, the command LIST* is executed and the line is displayed. If the second FIND command executes ("HP 3000" is found within 20 character positions), the flag is true and the OR command and the command following it (LIST *) are skipped. The line is not displayed in this case.

The iterations continue until the first FIND command fails and EDIT/3000 sets its flag to false.

   /FINDQ FIRST

   /WHILE

   /   FIND "EDIT/3000"(+9)

   /   BEGIN

   /      FIND "HP 3000"/*(+20)

   /      OR

   /      LIST *

   /      END

       1     1-2.  WHAT IS EDIT/3000?

                                   ^ (24 )

   *21*STRING NOT FOUND BEFORE LIMIT

   AT DEPTH 3

        1    1-2.  WHAT IS EDIT/3000?

        3    EDIT/3000 IS A SUBSYSTEM OF THE HP 3000

                       ^ (11 )

        3    EDIT/3000 IS A SUBSYSTEM OF THE HP 3000

                                             ^ (33 )

       11    MANIPULATED BY USING EDIT/3000 COMMANDS.

                                            ^ (32 )

   *21*STRING NOT FOUND BEFORE LIMIT

   AT DEPTH 3

       11    MANIPULATED BY USING EDIT/3000 COMMANDS.

       13    1-2.  EDIT/3000 FEATURES

                             ^ (17 )

   *21*STRING NOT FOUND BEFORE LIMIT

   AT DEPTH 3

       13    1-2.  EDIT/3000 FEATURES

       15    WITH EDIT/3000, IT IS POSSIBLE TO

                          ^ (15 )

   *21*STRING NOT FOUND BEFORE LIMIT

   AT DEPTH 3

       15    WITH EDIT/3000, IT IS POSSIBLE TO

   *21*STRING NOT FOUND BEFORE LIMIT

   AT DEPTH 2

   
Feedback to webmaster