Here is an even better way.  So that you don't have to figure out what is a
local or a remote database, use the "on drive" option of the list database
command.  Simply say "db2 list database directory on c" or "db2 list
database directory on d".  This will limit what is returned to only the
databases that are defined locally on that drive.  You specified the drive
when you created the database originally "db2 create database xyz on d".
You just need to issue the list database for each drive that may have a
database on it.

Thanks.


"Gert van der Kooij" <[EMAIL PROTECTED]>@lugwash.org on 03/21/2002 05:58:44
PM

Please respond to "Gert van der Kooij" <[EMAIL PROTECTED]>

Sent by:  [EMAIL PROTECTED]


To:   <[EMAIL PROTECTED]>
cc:

Subject:  Re: [DB2EUG] How can I get a listing of local databases via a db2
      command line.


Something like:

'db2 list db directory|rxqueue'
do while queued() > 0
    parse pull line
    select
    when (subwords(line,1,2) = 'Database name') then
        Dbname = word(line,4)
    when (subwords(line,1,3) = 'Directory entry type') then
        say 'Local Dbname = ' Dbname
    otherwise nop
end

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 21, 2002 10:56 PM
Subject: Re: [DB2EUG] How can I get a listing of local databases via a db2
command line.


>
> That example didn't come out like I wanted.  Maybe this will be better.
>
> Search for the word "indirect" and go back a retrieve the database
> name that is 4 lines above it.
>
> Database 5 entry:
>
>  Database alias                  = TESTDB
>  Database name                   = TESTDB<===Retrieve this
>  Database drive                  = D:\DB2
>  Database release level          = 9.00
>  Comment                         =
>  Directory entry type            = Indirect<===Find this
>  Catalog node number             = 0



-
:::  When replying to the list, please use 'Reply-All' and make sure
:::  a copy goes to the list ([EMAIL PROTECTED]).
***  To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
***  For more information, check http://www.db2eug.uni.cc




******************* PLEASE NOTE *******************
This E-Mail/telefax message and any documents accompanying this
transmission may contain privileged and/or confidential information and is
intended solely for the addressee(s) named above.  If you are not the
intended addressee/recipient, you are hereby notified that any use of,
disclosure, copying, distribution, or reliance on the contents of this
E-Mail/telefax information is strictly prohibited and may result in legal
action against you. Please reply to the sender advising of the error in
transmission and immediately delete/destroy the message and any
accompanying documents.  Thank you.

-
:::  When replying to the list, please use 'Reply-All' and make sure
:::  a copy goes to the list ([EMAIL PROTECTED]).
***  To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
***  For more information, check http://www.db2eug.uni.cc

Reply via email to