HP 3000 Manuals

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


HP EDIT Reference Manual

Test And Go To Macro 

Purpose 

Executes a macro 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 Go To Macro command, enabling 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 chaining to a macro from within a macro.  After the macro
called using this command finishes executing, the calling macro
terminates.

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 from within a macros: 

   1.  Incorporate this command where you want to branch to another macro
       without returning, but only if the flag is true.  Follow the
       command with the name of the macro you want to conditionally
       execute, as in:

            mZ=IAll employees/^m$Md; over 40 must respond./^m
            md=; must respond./^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 /^m$MGais not set/^m
            mG=ais set/^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 (m) command.  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, or inserts
       Flag is not set if the value is false.

Related Commands 

       Terminate True Clause
       Test And Execute Macro
       Test/Set/Clear Flag



MPE/iX 5.0 Documentation