Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...you guys have given us a way of asking a question and getting some very timely feedback from other users so we don't have to re-invent the wheel time and again..."

Geography

Where in the world do Tek-Tips members come from?
nagu123 (Programmer)
10 Jan 03 10:41
I have a typical situation where in ideploy batch programs on WINNT server and i want that to be scheduled at every given periods. Lets say every 15 min. This batch program basically process Orders and Allocate those orders in to different warehouses. Now if the batch programs overlap, meaning while one instance of batch program is running and working on an order, the other batch program might as well run and picks up the same order which this program is currently executing. How should i prevent such a situation in real time. THe batch programs are written in Visual Basic(6.0).
vb5prgrmr (Programmer)
10 Jan 03 10:45

Well if it is a single batch program that does all of your  processing then you could use...

If App.PrevInstance = True Then
  'place code here to exit
End If


Good Luck

nagu123 (Programmer)
10 Jan 03 10:53
But i dont want the Batch program to be disabled. I only want that the 2 batch programs process the same order. Let me elaborate on this more. THe batch program basically picks up all the orders with some status say Placed and dumps them in to another table and starts processing each order from that table. Now when the second batch program is scheduled, it does the same process again. Now while doing that i dont want Orders to be overwritten and i dont want all the orders which are already been processed by the previous batch program. I hope i am clear.
vb5prgrmr (Programmer)
10 Jan 03 11:13

So let me get this straight. You have a program that spawns another program that does something like ...

1. Looks for new entries in table1
2. If new entries are found in table1 move them to table2 for processing (and mark them as moved in table1)
3. Look in table2 for newly added records (from step 2)
4. Process those records just added in table2
5. Once done with processing, end

If you have something like the above then you can accomplish steps 1 to 3 in a stored proceedure. Your logic in the stored proceedure would be something like...

1. Look for new entries in table1
2. If new entries are found update table1 and move to table2
3. retrun recordset of new entries in table2

This would essentially divide each process into having their own unique recordset that would not overlap.

Good Luck

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close