Alan,
From what abstract has told me, I have only two programs that access that
file, and both are set to update mode. I am still not comfortable that we
have plugged the hole completely.
Maybe its I would have probably used a data area (would love to recreate
it as a table and use an increment field - but that's not possible) and
then the problem goes away.
From: Alan Shore <AlanShore@xxxxxxxx>
To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Date: 10/17/2008 09:27 AM
Subject: Re: File locking / field locking
----------------------------------------------------------------------
Hi Doug
The lock is on the record you have just READ and NOT the record you want
to
add.
It is still feasible for another process to read the same files as
input/add, read the same record that you have just locked, and add the
same
record you want to add, thus creating duplicates.
The best way around this is to make the file unique on that field and by
using monitor, to capture the error of attempting to create a duplicate
record
Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxxxxx
P:(631) 244-2000 ext. 5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill
rpg400-l-bounces@xxxxxxxxxxxx wrote on 10/17/2008 09:56:39 AM:
> I have two files SourcePF is my physical file and SourceLF is a
logical
> built over that PF. Both are included in the program as update files
with
> add.
>
> In a subroutine the program sets a HIVAL on the logical and then does
a
> readp in order to get the highest shipping number. At this point I
> believe this field is locked and no other process can access read
that
> record. it then increrments the count and writes it to a variable.
The
> other variables are setup and then the program finally writes a new
record
> to the Physical file, which at that point the lock is released
correct?
>
> I am just checking every possible place for this thing to create
duplicate
> records (I did not write the code, just plugging the hole).....and
making
> sure that neither program can dup up the same number.
> This transmission may contain information that is privileged,
confidential
> and/or exempt from disclosure under applicable law. If you are not
the
> intended recipient, you are hereby notified that any disclosure,
copying,
> distribution, or use of the information contained herein (including
any
> reliance thereon) is STRICTLY PROHIBITED. If you received this
> transmission in error, please immediately contact the sender and
destroy
> the material in its entirety, whether in electronic or hard copy
format.
> Thank you.
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at
http://archive.midrange.com/rpg400-l.
>
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
This transmission may contain information that is privileged, confidential
and/or exempt from disclosure under applicable law. If you are not the
intended recipient, you are hereby notified that any disclosure, copying,
distribution, or use of the information contained herein (including any
reliance thereon) is STRICTLY PROHIBITED. If you received this
transmission in error, please immediately contact the sender and destroy
the material in its entirety, whether in electronic or hard copy format.
Thank you.
As an Amazon Associate we earn from qualifying purchases.