Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to run DB2 UDB batch commands on NT?

372 views
Skip to first unread message

Michael Appelmans

unread,
May 28, 1998, 3:00:00 AM5/28/98
to

How do I run a db2 clp cmd such as FORCE APPLICATION in a batch (.cmd) file
on NT.

When I try "DB2 FORCE APPLICATION" I get the error:
DB21061E Command line environment not initialized.

Any suggestions would be appreciated. Thanks
--
Michael Appelmans

Agility, Inc.
*SpamBam - remove 123 to mail*
mappe...@123agility-inc.com

ray....@cmsx.com

unread,
May 29, 1998, 3:00:00 AM5/29/98
to

Try running db2cmd db2 batchfile.cmd

In article <356db...@news1.ibm.net>,


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading

Ray Houle

unread,
May 29, 1998, 3:00:00 AM5/29/98
to

You must or :
initialize your DOS session for DB2 by issuing the DB2CMD command, this will
bring a DOS command window from which you may issue DB2,
or
Using the mouse Start/Programs/DB2 For WindowsNT/Command Window or Command Line
Processor.

From this point if you wish to execute a "script" or :
use a batch file (*.bat) include your commands prefixed with DB2 and separated
by a semicolon.
or
setup a SQL script (e.g. Temp.SQL) same as the batch file but without the DB2
at the start of each SQL
command. The type DB2 -vtf Temp.SQL

Hope this helps

Michael Appelmans

unread,
May 29, 1998, 3:00:00 AM5/29/98
to

Thanks for your reply.


DB2CMD DB2 batchfile.cmd doesn't work.

I tried it with just one command in the file such as:
LIST DATABASE DIRECTORY
or
FORCE APPLICATIONS ALL

and I get:
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL1024N A database connection does not exist. SQLSTATE=08003

Thanks again.
--
Michael Appelmans

Agility, Inc.
*SpamBam - remove 123 to mail*
mappe...@123agility-inc.com

ray....@cmsx.com wrote in message <6km8jo$n9m$1...@nnrp1.dejanews.com>...


>Try running db2cmd db2 batchfile.cmd
>
>In article <356db...@news1.ibm.net>,

> "Michael Appelmans" <map...@ibm.net> wrote:
>>
>> How do I run a db2 clp cmd such as FORCE APPLICATION in a batch (.cmd)
file
>> on NT.
>>
>> When I try "DB2 FORCE APPLICATION" I get the error:
>> DB21061E Command line environment not initialized.
>>
>> Any suggestions would be appreciated. Thanks
>> --
>> Michael Appelmans
>>
>> Agility, Inc.
>> *SpamBam - remove 123 to mail*
>> mappe...@123agility-inc.com
>>
>>
>
>

Michael Appelmans

unread,
May 29, 1998, 3:00:00 AM5/29/98
to

I'm trying to run a shutdown of DB2 and backup from scheduler NTCROND so
there won't be any humans around to start the command line processor and run
scripts. I know the script window has a script scheduler but I need this
coordinated from the outside world because of other non DB2 events occuring
(such as Java routines being run).

Thanks for your reply.

--
Michael Appelmans

Agility, Inc.
*SpamBam - remove 123 to mail*
mappe...@123agility-inc.com

Ray Houle wrote in message <356EA810...@sympatico.ca>...


>You must or :
>initialize your DOS session for DB2 by issuing the DB2CMD command, this
will
>bring a DOS command window from which you may issue DB2,
>or
>Using the mouse Start/Programs/DB2 For WindowsNT/Command Window or Command
Line
>Processor.
>
>From this point if you wish to execute a "script" or :
>use a batch file (*.bat) include your commands prefixed with DB2 and
separated
>by a semicolon.
>or
>setup a SQL script (e.g. Temp.SQL) same as the batch file but without the
DB2
>at the start of each SQL
>command. The type DB2 -vtf Temp.SQL
>
>Hope this helps
>

Michael Appelmans

unread,
May 29, 1998, 3:00:00 AM5/29/98
to

Ok Ok!! It works with D:\Work>db2cmd db2 "-r batchfile.cmd"

However the DB2CMD window remains open. Since I have to run this in
unattended mode (repeatedly) I need a way to close the DB2cmd session from
within batchfile.cmd. Quit and exit do not work. Any suggestions?

>Try running db2cmd db2 batchfile.cmd
>
>In article <356db...@news1.ibm.net>,

> "Michael Appelmans" <map...@ibm.net> wrote:
>>
>> How do I run a db2 clp cmd such as FORCE APPLICATION in a batch (.cmd)
file
>> on NT.
>>
>> When I try "DB2 FORCE APPLICATION" I get the error:
>> DB21061E Command line environment not initialized.
>>
>> Any suggestions would be appreciated. Thanks
>> --
>> Michael Appelmans
>>
>> Agility, Inc.
>> *SpamBam - remove 123 to mail*
>> mappe...@123agility-inc.com
>>
>>
>
>

Nolly Unvala

unread,
May 31, 1998, 3:00:00 AM5/31/98
to

On Fri, 29 May 1998 16:50:00 -0400, Michael Appelmans wrote:

:>However the DB2CMD window remains open. Since I have to run this in


:>unattended mode (repeatedly) I need a way to close the DB2cmd session from
:>within batchfile.cmd. Quit and exit do not work. Any suggestions?

Try DB2CMD /C ...... rest of command line.

The "/C" will instruct NT to close the secondary window when
the command completes.

Michael Appelmans

unread,
Jun 1, 1998, 3:00:00 AM6/1/98
to

Oh that is sweet! Thanks a lot, Nolly.

--
Michael Appelmans

Agility, Inc.
*SpamBam - remove 123 to mail*
mappe...@123agility-inc.com

Nolly Unvala wrote in message ...

0 new messages