Record locking

Bill Vermillion fp at wjv.com
Wed Mar 31 07:24:27 PST 2004


On Wed, Mar 31, 2004 at 10:02:22AM -0500, GCC Consulting thus
spoke:


> I agree with you about doing nothing in between the "getting"
> of a unique number and the incrementing and writing of that
> field out as in:

>    them" lookup ctrl=cotrol_file r=("1") -p
>    then: num=ctrl(1);  ctrl(1)=ctrl(1)+"1";  write ctrl

> This is all the code that is needed... end of story. It works.
> It has always worked for me... and simply never failed. Again,
> I stipulate that this is on Unix and Xenix systems of the past
> 20 years. I can not vouch for the Windows product.

> One other minor point. Richard's code that goes out to check if
> the number has been used before... well, that makes _no_ sense
> to me. Why would you have to check such a thing? If you are
> only supplying the next highest number out of a control file in
> the way shown above... there is no need to check whether the
> number you've just retrieved has ever been used... how could it
> be?

....

GCC replied with this.

> -----------------------------------------------------------------

...

> 2. I have some unique requirements at this client's site and
> that is to allow them to enter an order # instead of using the
> "next available order #". Not the best of situations, however
> they are paying the bills and I have to accommodate their
> requirements. This makes it necessary for me to check the
> value. In most cases, a manually entered order # will be below
> 1000. It will be entered, processed and then deleted. These
> are orders that they don't want in their sales history, but do
> appear in their accounting.

> 3. I also have to implement an order number control file which
> holds any "cancelled" order #'s. i.e. the order started and the
> stopped for one reason or another. At the present time, the
> clerk can restart the order, enter the order # again, and if
> not used by someone else, continue with it.

In an instance where things might stop, I never created the
tracking number [similar to your order number] until the SAVE [eg
EscEsc] was pressed.

I trapped for that key, and the save routine then retreived the
correct number.  I did this cleaning up a site that would have many
numbers missing when the previous programmer retreived a number as
one of the first things they did, and then when the order was
never completed, there was no order and the control file had been
perivously incremented so that it appeared to have holes in the
order number list.


-- 
Bill Vermillion - bv @ wjv . com


More information about the Filepro-list mailing list