DB2 Connect User's Guide

Command Line Processor

The command line processor lets you issue SQL statements against a host or AS/400 database server, preceded by db2. For differences between host and AS/400 SQL and DB2 Connect SQL, see Host or AS/400 Server SQL Statements Supported by DB2 Connect and Host or AS/400 Server SQL Statements Rejected by DB2 Connect.

To invoke the command line processor in interactive input mode, do the following:

OS/2
Click OS/2 Warp, and select IBM DB2 --> Command Line Processor or enter the db2 command.

Windows 32-bit operating systems
Click Start, and select Programs --> IBM DB2 --> Command Line Processor.
Note:You can also invoke the command line processor in interactive input mode by entering the db2cmd command followed by the db2 command at an MS-DOS prompt.

UNIX
Enter the db2 command from the command line processor

In interactive input mode, the prompt looks like this:

   db2 =>

In interactive input mode, you do not have to enter DB2 commands with a db2 prefix; instead, you just enter the DB2 command. For example:

   db2 => list database directory

To enter operating system commands in interactive mode, precede the operating-system command with an exclamation mark (!). For example:

   db2 => !dir

If you need to enter a long command that does not fit on one line, enter a space followed by the line continuation character, \. When you have reached the end of the line, press the Enter key to continue entering the command on the next line. For example:

   db2 => select empno, function, firstname, lastname, birthdate, from \
   db2 (cont.) => employee where function='service' and \
   db2 (cont.) => firstname='Lily' order by empno desc

To end interactive input mode, enter the quit command.

Before you can use the command line processor, it must be bound, as described in Binding Applications and Utilities.
Note:When using the command line processor in UNIX-based systems without being in interactive input mode, you must put double quotes around special characters (such as * and ?) when issuing SQL statements.

For more information on SQL commands, refer to the Command Reference.


[ Top of Page | Previous Page | Next Page ]