HP 3000 Manuals

Test And Execute Macro [ HP EDIT Reference Manual ] MPE/iX 5.0 Documentation


HP EDIT Reference Manual

Test And Execute Macro 

Purpose 

Executes a macro as a subroutine if the flag is set.

Default Syntax 

$m

Description 

This command, when used within a macro, combines the functions of the
Test/Set/Clear Flag command and the Execute Macro command.  This command
enables you to conditionally execute a specified macro, depending on the
value of a settable flag.

If the value of the flag is true, this command executes the named macro
immediately following this command.  This provides a method of
conditionally executing a macro within a macro.  After the macro called
with this command finishes executing, HP EDIT returns to the next command
in the current macro.

Since the standard Meta key (ESC) is displayed as ^[ when inserted in a
macro, HP EDIT provides the dollar sign ($) as an alternate Meta key.
Consequently, you should use the recommended syntax of $m within a macro.

Refer to the Define Macro command for information about macro syntax, and
refer to the Test/Set/Clear Flag command command for information about
the flag.

Procedures 

To use this command within a macros: 

   1.  Incorporate this command where you want to execute a macro if the
       flag is true, followed by the the name of the macro you want to
       conditionally execute, as in:

            mZ=IAll employees/^m$md; must respond./^m
            md=; over 40/^m

Example 

To construct and execute a macro that indicates the value of the flag: 

   1.  Insert a new line in text by executing the Insert Line (I)
       command.

   2.  Type the following macros beginning at the start of the line:

            mf=IFlag is /^m3$t$mnaset/^m3$t+
            mn=anot /^m

   3.  Press / and Return to exit Text Entry mode and enter Command mode.

   4.  Move the cursor to the first macro and execute the Define Multiple
       Macros (ESC z) command.  HP EDIT deletes the macros from the
       screen and stores them for subsequent execution.

   5.  Issue the Execute Macro command (m).  HP EDIT displays the
       following prompt on the message line:

            Specify macroname

   6.  Press the f key.  HP EDIT tests the flag and inserts the text Flag 
       is set into your file if the value of the flag is true, and
       inserts Flag is not set if the value is false.

Related Commands 

       Terminate True Clause
       Test/Set/Clear Flag
       Test And Go To Macro



MPE/iX 5.0 Documentation