I think all you need to do is add the "for update of ... " clause. As I recall, this forces the fetch to lock the current row, pending the "UPDATE ... WHERE CURRENT OF myCursor".
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Steve Richter
Sent: Wednesday, March 20, 2013 1:30 PM
To: Midrange Systems Technical Discussion
Subject: equivalent of lock and update in SQL
in rpg record I/O I lock a control record, increment a control number, then
update the control record. Which reliably gives me a unique value.
C** GET NEXT SID NUMBER FROM WCMAST
C inwacd CHAIN WCREC
C EVAL WCNSID += 1
C UPDATE WCREC
outSid = wcnsid ;
Can I use SQL to do the same thing?