Try adding these 2 lines
....it should stop the problem
.....sometimes weird things happen with "reade"
.....this makes it so it will not enter the loop if it's not there
/Free
W_Cust = 1131;
Setll (W_Cust) SrlMast01;
If %Equal(SrlMast01); <--- 1
Reade (W_Cust) SrlMast01; //Record lock occurs here
Dow Not %Eof(SrlMast01);
//DO something here
Reade (W_Cust) SrlMast01;
EndDo;
EndIf; <--- 2
*Inlr = *On;
/End-Free
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Schadd
Sent: Wednesday, June 29, 2011 7:44 AM
To: RPG programming on the IBM i / System i
Subject: Record lock issue
I have a very strange issue occurring. This is happening on V7R1 and on
V5R4. I have a program aborting on a record lock for a record it should not
be trying to access. I am assuming this is an OS issue, however I thought I
would check with the community before opening a ticket. I am probably just
having a senior moment or maybe it has always been this way and I have just
never ran into it before.
The first program chains to a file and locks the record.
FSrlMast01 UF E K Disk
D W_Cust S Like(SLCust#)
/Free
W_Cust = 1133;
Chain (W_Cust) SrlMast01;
If %Found(SrlMast01); //Stop the program here in debug to cause
record lock
//Do something here
EndIf;
*Inlr = *On;
/End-Free
The second program does a SETLL and a READE to the file. The key value does
not exist in the file. If the key value exists in the file, no record lock
happens.
FSrlMast01 UF E K Disk
D W_Cust S Like(SLCust#)
/Free
W_Cust = 1131;
Setll (W_Cust) SrlMast01;
Reade (W_Cust) SrlMast01; //Record lock occurs here
Dow Not %Eof(SrlMast01);
//DO something here
Reade (W_Cust) SrlMast01;
EndDo;
*Inlr = *On;
/End-Free
Data:
SLCust#(Key) SLName SLAddr
1129 John Smith 111 Main
1130 John Doe 222 Main
1133 Jane Doe 555 W. 7th
Thank you,
Schadd Gray
Damon Technologies, Inc.
www.damontech.com
--
This is the RPG programming on the IBM i / System i (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.
As an Amazon Associate we earn from qualifying purchases.