Results 1 to 5 of 5

Thread: db2clp

  1. #1
    Join Date
    Dec 2005
    Posts
    7

    Red face Unanswered: 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 04:55.

  2. #2
    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

  3. #3
    Join Date
    Jan 2003
    Posts
    1,605
    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 08:55.

  4. #4
    Join Date
    Apr 2004
    Posts
    54
    look at db2clpex.exe as well )

  5. #5
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •