The way to do this is straightforward.
One. Redesign your application so it doesn't hold a lock on the file.
The key verb is "hold". Your application acquires a lock when it needs
one and releases it as soon as it can.
Two. Redesign your application so it is insensitive to changes in the
file.
With this done, an ALTER table or CHGPF can be done and your application
will wait while the change takes place (the change will have an
exclusive lock) and then resume.
Several ways to keep from holding a lock: CLOSE the file within your
program after every use and OPEN it only when needed. Use SQL SELECT
statements which don't hold a lock. Use SQL CURSOR for read only.
To make your application insensitive to changes: Specify LVLCHK *NO on
compile and be careful not to change existing fields when adding a
field. Use embedded SQL with naming the individual fields (no *) in the
SELECT statements.
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan Shore
Sent: Saturday, May 09, 2009 12:18 PM
To: Midrange Systems Technical Discussion
Subject: Stupid question of the century
Hi guys
I've just been asked the following question by my boss's boss Is there
anyway to add new fields (columns) "on the fly" to an existing file,
without having an exclusive lock on that file.
In other words, the file is still being used while the field is added I
know that chgpf is out of the question (unless someone proves me wrong).
I know that SQL is also out of the question (ALTER TABLE x ADD
EXTRAFIELD DEC(7, 2) NOT NULL DEFAULT 0) - again unless someone proves
me wrong If anyone knows of any way, any language, any procedure, any
function to achieve this, please drop me a line.
Thanks in advance
Alan Shore
Programmer/Analyst, Distribution
E:AShore@xxxxxxxxxxx
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.