If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > db2clp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-05-05, 03:41
Joshua Lee Joshua Lee is offline
Registered User
 
Join Date: Dec 2005
Posts: 7
Red face db2clp - DB21061E Command line environment not initialized

Hi Grofaty,

I tried using the db2clp command in batch file and run on dos prompt, it works. However if I re-start my PC and re-run again, it hit 'DB21061E Command line environment not initialized.'

Please advise how you resolved this error? To what I know the db2clp no. is always changing once the PC was re-started.

Thank you very much.

Regards,
Joshua

Last edited by Joshua Lee; 12-05-05 at 03:55.
Reply With Quote
  #2 (permalink)  
Old 12-05-05, 07:13
wangzhonnew wangzhonnew is offline
Registered User
 
Join Date: Nov 2005
Location: Toronto
Posts: 65
executed db2cmd?
__________________
IBM Certified DBA for DB2 UDB
IBM Certified Database Developer for DB2 UDB
DB2 Tech Support, IBM Toronto Software Lab
Reply With Quote
  #3 (permalink)  
Old 12-05-05, 07:41
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Joshua Lee,

Here is a sample for exporting one table to IXF format using batch files. There is also an IF logic if something goes wrong. All messages are recorded into commands.log LOG file to see the results.

Contents of run.bat is:
Code:
db2cmd /i /c commands.bat
Contents of commands.bat is:
Code:
db2 connect to sample user db2adim using db2adin >> commands.log 
if not %errorlevel% == 0 goto error

db2 export to c:\table.ixf of ixf select * from db2admin.table >> commands.log
if not %errorlevel% == 0 goto error

db2 connect reset >> commands.log
if not %errorlevel% == 0 goto error
goto end

:error
echo "Error" >> commands.log
exit

:end
echo "OK" >> commands.log
exit
You will need to modify commands.bat file according to your needs. Then execute run.bat file to let commands.bat be executed.

Hope this helps,
Grofaty

Last edited by grofaty; 12-05-05 at 07:55.
Reply With Quote
  #4 (permalink)  
Old 12-05-05, 09:49
gardenman gardenman is offline
Registered User
 
Join Date: Apr 2004
Posts: 54
look at db2clpex.exe as well )
Reply With Quote
  #5 (permalink)  
Old 12-05-05, 21:38
Joshua Lee Joshua Lee is offline
Registered User
 
Join Date: Dec 2005
Posts: 7
Smile db2clp - DB21061E Command line environment not initialized

Hi gardenman,

Thank you so much.
I used the following to run on dos command prompt and it worked:

db2clpex cmd /i /c ap_stmt_upload_isin

Thank you once again.

Yours sincerely,
Joshua Lee
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On