SQL/MP Installation and Management Guide

Managing Database Applications
HP NonStop SQL/MP Installation and Management Guide523353-004
10-30
Using DEFINEs
Using DEFINEs
A DEFINE is a named set of attributes and associated values stored in the process file
segment (PFS) of a running process.
By using logical names, you can run SQLCI commands and host programs using
different sets of files, depending on the DEFINEs in effect at the time. Application code
that uses logical names instead of hard-coded file names can be compiled or executed
to use different physical databases.
You can use a DEFINE name to specify a subvolume, catalog, table, view, collation, or
index in SQL/MP statements and commands and in host application programs.
Typically, you use a DEFINE to establish a one-to-one mapping between a logical
name and a physical name. When combined with execution-time name resolution, you
can use DEFINEs to run a program against a different database or dynamically select
a database at run time.
There are several ways to use DEFINEs with SQL/MP at compile time, from SQLCI,
and from within programs.
Entering DEFINE Commands
To use DEFINEs, preset the DEFINE names and attribute values by entering DEFINE
commands at the command interpreter or SQLCI prompt or by using Guardian DEFINE
procedures in a host language program. When you run an SQL statement or SQLCI
command that includes a DEFINE name, the system substitutes the name of the actual
object for the logical name.
The SQL software uses DEFINEs to override default processing for SQL components.
For information about these DEFINEs, see the SQL/MP Reference Manual.
DEFINE Rules
These rules apply when using DEFINEs in applications and in SQLCI:
A DEFINE name can contain from 2 to 24 characters; the first character must be
an equal sign (=), and the second must be a letter (for user-defined names). After
the first two characters, the name can contain any combination of alphanumeric
characters, hyphens (-), underscores (_), and circumflexes (^).
Some examples of DEFINE names follow:
=EMPLOYEE
=DEPT_MGR_NAMES
=AR_CATALOG
=MGR_PROTECTION_VIEW
Note. A special class of DEFINE names begins with an equal sign and an underscore (=_).
These names are reserved for HP use only. Do not attempt to create DEFINE names that
begin with these two characters unless specifically directed to do so in NonStop system
documentation.