beautypg.com

IBM Data Server DB2 User Manual

Page 237

background image

Chapter 5. Deploying pre-configured databases

223

or all the statements are executed within the same unit of work. If executing
all the statements in one unit of work is preferred, add

-c-

as an option. For

example:

db2 -c- -f itsodb.ddl

The CLP also has options to direct the output and log the messages. We show
how to obtain a complete history in a log file, and how to run the CLP in silent or
non-silent mode.

-l filename
This option tells the command line processor to log commands and
statements executed in a history file.

-o
This option control whether the CLP displays output data and messages to
standard output. Default value is on. To run the CLP in silent mode, add

-o-

as an option. For example:

db2 -o- -f itsodb.ddl

The typical scenario is to use the

-l

option to obtain a log, which can be used for

verification and error handling, and then turn output on/off with the

-o

option

based on the progress information requirements in the user interface.

CLP return codes

When the CLP finishes processing a command or an SQL statement, it returns a
return code. You can validate the return code in the script and take actions based
on the value.

Table 5-1 lists the CLP return codes. The

-s

option has impact on whether the

execution will stop or continue for the various return codes. C in the last column
indicates that the execution will continue, while the

S

indicates that the execution

will stop.

Table 5-1 CLP return codes and the impact of the -s option

Code

Description

-s/-s-

0

DB2 command or SQL statement executed successfully

C/C

1

SELECT or FETCH statement returned no rows

C/C

2

DB2 command or SQL statement warning

C/C

4

DB2 command or SQL statement error

C/S

8

Command line processor system error

S/S