Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2014
    Posts
    294

    Answered: Parallel processing of procedures

    Hi,

    I have a requirement as I am having 4 procedures as p1,p2,p3,p4. In a normal way I can run these 4 procedures in a serial manner. after p1 got completed successfully , control is going to the next procedure p2 & so on p3,p4.

    My requirement is I have to initiate procedures p1 & without waiting for that to complete it should initiate p2,p3 & p4 at a time as parallel execution.
    I can't use ATS jobs for this as I am running under federation databases.
    Even I can't use IBM data studio as I have to work on client site ,where data studio installation is not allowed.

    Can someone kindly give me a hint how to achieve this on db2luw.
    I am using windows with db2 c express

  2. Best Answer
    Posted by przytula_guy

    "just execute a cmd file that does db2cmd ....... with a specific command or file to execute and on the next line another db2cmd....
    these will open individual windows with parallel execute"


  3. #2
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    This is not a DB2 question per se, it is a programming question, specifically how to run multiple tasks in parallel.

    (It's only a detail that those tasks might access an RDBMS).

    On MS Windows, you have two options: multiple processes (each with its own connection to the database, each calls an sproc), or multiple threads in a single process (threads run concurrently, each thread with its own separate connection to a database and running an sproc in that thread).

    Separate processes on Windows can be achieved with plain batch files/ powershell scripts / binary executable-programs.

    Separate threads on Windows can be achieved using windows threading, or whatever features your chosen programming language offers (java , c++ etc offer threading capabilities).

    Depending on your programming skills, you can also write an external UDF that spawns independent processes, or separate threads.

  4. #3
    Join Date
    Jul 2014
    Posts
    294
    Thanks for the reply db2mor.

    I am not supposed to use any wizards or tools. I have to use some scripts itself to achieve this.
    Can you kindly provide me an example of windows batch script just to connect to the db2 database & to call two procedures parallel.

    I would be very thankfull to you & I can mend that according to my requirement.

    Million Thanks

  5. #4
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    IBM provides the samples. Look on your DB2 installation path default \program files\ibm\sqllib\samples - search under there for files with names like *.BAT and *.CMD and study them. You must put in the hours to learn to program batch file scripts.

  6. #5
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    just execute a cmd file that does db2cmd ....... with a specific command or file to execute and on the next line another db2cmd....
    these will open individual windows with parallel execute
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  7. #6
    Join Date
    Jul 2014
    Posts
    294
    Thanks for the answer przytula_guy. Your solutions are always awesome.

Tags for this Thread

Posting Permissions

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