NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
O-3
Examples—OBEY
OBEY. SQLCI closes the command file and prompts you for a new command. If a
transaction is in progress, it is rolled back.
If BREAK_KEY is OFF, pressing the Break key interrupts execution and passes
control to the previous Break key owner, usually TACL. From TACL, enter PAUSE
to resume or STOP to terminate SQLCI.
Examples—OBEY
The following example shows the contents of a simple command file that sets
DEFINE values:
SET DEFMODE ON;
ADD DEFINE =REP, FILE \SYS1.$VOL2.SALES.SALESREP;
ADD DEFINE =CUST, FILE \SYS1.$VOL2.SALES.CUSTOMER;
ADD DEFINE =ORD, FILE \SYS1.$VOL2.SALES.ORDERS;
If the commands are in a file named DEFS, you could execute them from SQLCI by
typing the following:
OBEY DEFS;
The following example shows a command file that uses both sections and
parameters. The example also shows the SQLCI output when OBEY executes a
short section from a command file.
The contents of UPDOP, the command file, are as follows:
?SECTION NEWJOB
UPDATE PERSNL.EMPLOYEE
SET JOBCODE=?JCOD WHERE EMPNUM=?EMPN;
?SECTION NEWSAL
...
?SECTION NEWDEPT
...
The following commands execute section NEWJOB from the command file. The
first two commands (SET PARAM and OBEY) are entered by the user; everything
else is printed by SQLCI, echoing and responding to commands from the file as it
executes them.
>>SET PARAM ?EMPN 557, ?JCOD 500;
>>OBEY UPDOP (NEWJOB);
>>?SECTION NEWJOB
>>UPDATE PERSNL.EMPLOYEE
+> SET JOBCODE = ?JCOD WHERE EMPNUM = ?EMPN;
--- 1 row(s) updated.