IBM Books

Quick Beginnings for DB2 Connect Enterprise Edition


Using the Command Line Processor

You can use the command line processor to enter SQL statements, DB2 commands, and operating system commands. It operates in the following modes:

Interactive Input Mode
You can enter operating systems commands, DB2 commands or SQL statements and view their output.

Command Line Mode
The DB2 command line processor behaves like a command window from your operating system. You can enter operating system commands, DB2 commands, or SQL statements and view their output.

File Input Mode
Refer to the Command Reference for information on the file input mode.

Interactive Input Mode

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

You can also invoke the command line processor in interactive input mode by entering the db2cmd command followed by the db2 command at a command prompt. In interactive input mode, the prompt looks like this:

   db2 =>

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

  db2 => list node directory

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

   db2 => !dir


note

Windows 3.x does not support this method of running operating system commands.

If you need to enter a long command that does not fit on one line, use the line continuation character, \. For example:

   db2 => select empno, lastname, birthdate, from \
   db2 (cont.) => employee where sex='F' order by empno desc
Note:You do not need to use a line continuation character when entering long commands in interactive input mode on Windows 3.x workstations.

To end interactive input mode, enter the quit command.

For more information on advanced topics using the command line processor, refer the Command Reference.

Command Line Mode

On OS/2 and UNIX operating systems, you can enter DB2 commands from a command prompt. You must include the db2 prefix. For example:

   db2 list node directory

To invoke the command line processor in command line mode on Windows 32-bit operating systems, use one of the following methods:

After you invoke the DB2 command environment, you can enter DB2 commands at the command prompt. You must include the db2 prefix.

Notes:

  1. If the DB2 command contains characters that have special meaning on the operating system you are using, you will need to enter the command in quotation marks to ensure that it is run properly. For example, the following command will successfully retrieve all the information from the employee table, even if the * character has a special meaning on the operating system:
       db2 "select * from employee"
    

  2. The command line mode is not available on Windows 3.x systems.

For more information on using the command line processor, refer to the Command Reference.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]