SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-36
Using DEFINEs From MXCI
Using DEFINEs From MXCI
Make sure DEFMODE is set to ON in TACL or the OSS shell.
DEFMODE is ON by default but can be set to OFF in TACL or the OSS shell. To
inherit DEFINEs from the process that starts MXCI, such as TACL or the OSS
shell, verify that DEFMODE is ON before you start MXCI. If you set DEFMODE
OFF before you start MXCI, you will not inherit DEFINEs, and you will not be able
to create new DEFINEs during the MXCI session.
For more information on how to show or change the DEFMODE setting in TACL or
the OSS shell, see the TACL Reference Manual or the Open System Services
Shell and Utilities Reference Manual, respectively.
DEFINEs that you create during an MXCI session remain in effect until you alter
them, delete them, or end the MXCI session. DEFINEs you inherit from another
process and then modify with MXCI commands revert to their previous attribute
values (that is, the values they had when you started MXCI) when you end the
MXCI session. Any changes you make to inherited attributes within the MXCI
session apply only until you exit MXCI.
MXCI resolves DEFINE names in a statement at the time you enter or execute the
statement.
For more information on using DEFINEs with SQL programs, see the SQL/MX
Programming Manual for C and COBOL.
DEFINEs of Class MAP
In NonStop SQL/MX, DEFINEs can have only one CLASS attribute, the MAP class. A
DEFINE of class MAP associates a DEFINE name with the name of a table, view, or
partition. You can use the DEFINE name in SQL statements as the logical name of a
table, view, or partition, altering the DEFINE (but not the SQL statement) when you
want to point to a different physical entity.
For example, this command adds a DEFINE that assigns the logical name =ORDERS
to the table whose name is $SAMDB.SALES.ORDERS:
ADD DEFINE =ORDERS, CLASS MAP, FILE $SAMDB.SALES.ORDERS;
While this DEFINE is in effect, you can refer to the table as =ORDERS in SQL
statements.
MAP is the default class, so the previous command is normally equivalent to:
ADD DEFINE =ORDERS, FILE $SAMDB.SALES.ORDERS;