HP 3000 Manuals

DEFINE Command [ HP ALLBASE/4GL Developer Reference Manual Vol. 2 ] MPE/iX 5.0 Documentation


HP ALLBASE/4GL Developer Reference Manual Vol. 2

DEFINE Command 

The DEFINE command defines an abbreviation for an expression (defines a
macro) for subsequent referencing in the current logic block.

Format 

DEFINE %definition_name% expression 

Parameters 

definition_name 

A string, consisting of 1 to 4 characters, which identifies the
expression.

expression 

May be any series of characters that are to be inserted into a logic
command.

Description 

The DEFINE command defines a macro.  That is, it equates a definition
name to an expression so you can use the abbreviated name in place of the
expression in subsequent commands in the same logic block.

You must always surround the abbreviation by percent signs (%) whenever
you use it in a command.  When HP ALLBASE/4GL encounters the
construct%xxxx% (where xxxx is the abbreviation), it replaces the
abbreviation with the defined expression.  HP ALLBASE/4GL replaces the
abbreviation with the expression before it performs any syntax checking
or generation.

Using DEFINE macros can simplify some changes to HP ALLBASE/4GL logic
commands.  For example, if you equate a file name to a DEFINE macro, any
changes to the file name simply require a change to one command, assuming
all subsequent commands in the same logic block use the abbreviated form
of the file name.

Limitations 

DEFINE commands must be at the beginning of the logic block and precede
all other commands in the logic block.

The DEFINE command is only valid within one logic block.  If you want to
use the same abbreviation in several logic blocks, you must define the
abbreviation in each logic block.

The DEFINE command cannot be used to define abbreviations for logic
command names or command arguments.

Example 1 

DEFINE %F% TRANS.UNITCOST
DEFINE %kf% V-Current_Key
FILE *READ %F% *KEY= %kf%
MATH F-YEARLY_CST.%F% / 12 = V-EST_MTH_COST

These commands equate the file reference TRANS.UNITCOST to F, and the key
V-Current_Key to kf.  You can subsequently reference either by entering
%F% in place of the file name and %kf% in place of the file's key
specification.



MPE/iX 5.0 Documentation