Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

START/READ Anomaly ?
Let's assume we have an Indexed-Sequential file.
Further let's assume we have a known unique prime key/record.
Consider :
START file KEY = primekey INVALID ...
OK, we have a successful find.

Note that the START staement is so defined that
it does not detect, acquire or releaase locks (2002/2008).

So now another run-unit comes along, READ's direct
with LOCK and DELETE's our record.
(If the file is not in sequential access mode, we
do not even need the read)

Meanwhile our original program gets around to
doing a READ NEXT (with/without LOCK)

Our program had better check that what it gets
is really what it wanted !! (ie. returned key = key passed to START)

Problem is either :
a) Why isn't there a LOCK clause for START
or
b) Why isn't/wasn't the START syntax integrated into READ

Thoughts ?

Roger



Report this thread to moderator Post Follow-up to this message
Old Post
Roger While
07-14-06 08:55 AM


Re: START/READ Anomaly ?
My "programming 'style'" recommendation is to NOT to allow a DELETE of a REC
ORD
in one program - unless you have OPENed that file with
SHARING WITH READ ONLY

--
Bill Klein
wmklein <at> ix.netcom.com
"Roger While" <simrw@sim-basis.de> wrote in message
news:e97i6n$dcg$02$1@news.t-online.com...
> Let's assume we have an Indexed-Sequential file.
> Further let's assume we have a known unique prime key/record.
> Consider :
> START file KEY = primekey INVALID ...
> OK, we have a successful find.
>
> Note that the START staement is so defined that
> it does not detect, acquire or releaase locks (2002/2008).
>
> So now another run-unit comes along, READ's direct
> with LOCK and DELETE's our record.
> (If the file is not in sequential access mode, we
> do not even need the read)
>
> Meanwhile our original program gets around to
> doing a READ NEXT (with/without LOCK)
>
> Our program had better check that what it gets
> is really what it wanted !! (ie. returned key = key passed to START)
>
> Problem is either :
> a) Why isn't there a LOCK clause for START
> or
> b) Why isn't/wasn't the START syntax integrated into READ
>
> Thoughts ?
>
> Roger
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
07-14-06 08:55 AM


Re: START/READ Anomaly ?
Alternatively, have the file opened in DYNAMIC mode and READ the specific re
cord
WITH LOCK.

--
Bill Klein
wmklein <at> ix.netcom.com
"William M. Klein" <wmklein@nospam.netcom.com> wrote in message
news:FqItg.166624$LI3.60748@fe12.news.easynews.com...
> My "programming 'style'" recommendation is to NOT to allow a DELETE of a
> RECORD in one program - unless you have OPENed that file with
>   SHARING WITH READ ONLY
>
> --
> Bill Klein
> wmklein <at> ix.netcom.com
> "Roger While" <simrw@sim-basis.de> wrote in message
> news:e97i6n$dcg$02$1@news.t-online.com... 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
07-14-06 08:55 AM


Re: START/READ Anomaly ?
> a) Why isn't there a LOCK clause for START

Because LOCK is unnecessary when all you are doing is positioning the
pointer. (No access to data).

MCM







Report this thread to moderator Post Follow-up to this message
Old Post
Michael Mattias
07-14-06 12:55 PM


Re: START/READ Anomaly ?
Roger While wrote:
> Let's assume we have an Indexed-Sequential file.
> Further let's assume we have a known unique prime key/record.
> Consider :
> START file KEY = primekey INVALID ...
> OK, we have a successful find.
>
> Note that the START staement is so defined that
> it does not detect, acquire or releaase locks (2002/2008).
>
> So now another run-unit comes along, READ's direct
> with LOCK and DELETE's our record.
> (If the file is not in sequential access mode, we
> do not even need the read)
>
> Meanwhile our original program gets around to
> doing a READ NEXT (with/without LOCK)
>
> Our program had better check that what it gets
> is really what it wanted !! (ie. returned key = key passed to START)
>
> Problem is either :
> a) Why isn't there a LOCK clause for START
> or
> b) Why isn't/wasn't the START syntax integrated into READ
>
> Thoughts ?

Hmmm. Never tried that. Only time I do a START is when I don't know the key.
That implies I'm going to check the record on the subsequent read. If I do
know the key, I always READ (with lock).*

There may be some performance gain in doing a START for a known key followed
by a READ (in a multi-processing environment), but, as you point out, it
opens the door for problems.

====
* All our IO routines are subroutines and all reads are WITH LOCK. If we are
referencing only (no possibility of updating), then we make a decision: if
the code implies another read is imminent (which will release the lock), we
do nothing. If a non-updating read is followed by significant processing, we
UNLOCK the record.



Report this thread to moderator Post Follow-up to this message
Old Post
HeyBub
07-14-06 11:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:04 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.