It seems to me if you generate a temporary table of all possible numbers
in the range (step 1 below), that simply exception joining to the table
in question would give the desired result. Selecting the minimum value
from the exception join would satisfy the "smallest missing number"
requirement.
Loyd Goodbar
Business Systems
BorgWarner Shared Services
662-473-5713
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Mark S. Waterbury
Sent: Thursday, April 17, 2008 8:51 AM
To: Midrange Systems Technical Discussion
Subject: Re: Missing numbers ( was Re: )
Hello, David:
Try to use the "KISS" principle ("Keep It Super Simple!")
I think a simple solution could be:
1. create a table of available numbers
(a) use a batch program to initially load the "available numbers"
table,
with one sequential pass over the actual target table(s)
2. To allocate the next available number in your application(s):
(a) "pull" (SETLL, READ with record lock) the next available number
from "available" table
(b) immediately DELETE that number from "available" table (releases
record lock)
(c) use this number just obtained to insert into the actual target
table(s).
3. Periodically monitor how many numbers are available in each category,
e.g.:
SELECT COUNT(*) FROM availNbrs WHERE category = 'TX'
so you know when it is time to increase the size of those
numbers in the tables
Albert Einstein said, "Make it as simple as possible, but not simpler."
HTH,
Mark S. Waterbury
David FOXWELL wrote:
Thanks for all the replies and for giving my post a subject name.
...(snip)...
As an Amazon Associate we earn from qualifying purchases.