Tech Tip: Customizing the CLP
gorddbds 060001JCXS Visits (1608)
The CLP or Command Line Processor is the primary and lowest level interface available for DB2 LUW. It is capable of running SQL statements and DB2 commands, changing the DB2 Configuration and running DB2 scripts. The clp “db2” command can even be added to OS scripts to execute DB2 commands. The CLP also has various options that can be used to change its behavior, a few of these are:
-c option. This option changes the autocommit behavior. By default autocommit is on and the CLP issues a commit after every query run. By issuing db2 -c the autocommit behavior can be toggled on and off, as there are some situations where it may not be desirable to commit every query.
-l option . Using the -l <filename> option will cause the CLP to log the commands issued to a history file.
-m option. Adding the -m option will cause the CLP to print the number of rows effect by an INSERT, UPDATE, DELETE or MERGE statement.
The standard CLP “DB2” prompt can also be customized to display authorization Ids, instance and database names by using the db2 registry variable DB2_CLPPROMPT.
The following URL documents the options available for the CLP.
The following URL documents the features of the CLP and customizing the prompt.
The following URL documents the return codes from the CLP