Blogs

About this blog

Part of the IBM Analytics family, focused on Analytic Platform product support. This blog is administered by Andrew McCarl (amccarl) and Kate Nichols (KateDawson), and follows the IBM Social Computing Guidelines.

Links

Tags

Recent tweets

Tech Tip: Customizing the CLP

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.