On 09-Nov-2011 14:15 , Booth Martin wrote:
Here is a flyer: If you call up the record with UPDDTA and then
choose delete instead of update, but don't confirm the delete,
does that by any chance lock the record until you are done?
Not in my experience. I do not even recall any ability of the DFU
feature to open nor to share an ODP, using COMMIT(*YES) or not, and
irrespective of scoping.
However STRQM, 3=Tables, 10=Change Data will select for update and
then in a single-row FETCH will hold an UPDATE lock on the row presented
to the display, until exit or F14=Previous row or F15=Next data row.
The lock is held irrespective of isolation level. Although if the HLL
compilers are not installed, as for the OP, then the ST1 [SQL and QM]
product may not be installed either.
Second thought: By any chance, is REXX installed?
REXX is part of the OS, as is the capability to address "*EXECSQL",
or to just default to that statement processor via CMDENV(*EXECSQL) on
the STRREXPRC. A cursor declared FOR UPDATE and a FETCH of the row
should hold the lock.
The following REXX source [referred to as source member LCKTST]
should assist to interactively lock for update and hold a row, with
selection by RRN, for any file named in the TOFILE() of an OVRDBF
request issued just before the STRREXPRC. Scripted:
<code>
/* tell the rexx sql to lock a row in MyFile in MyLib */
ovrdbf LOCKMYROW TOFILE(MyLib/MyFile) OVRSCOPE(*JOB)
/* start rexx sql to lock rrn=3 when run interactively */
strrexprc LCKTST srcfile(qrexsrc) parm(3)
//DATA /* for the member LCKTST of file QREXSRC after: */
/* addpfm qrexsrc LCKTST srctype(REXX) */
/* text('open for update, fetch, wait on wrkjob') */
parse arg RRN
exitRC=0
address "*EXECSQL"
execsql "set option commit=*none, naming=*sys"
if rc<>0 then do; say sqlcode; exit 99; end;
execsql "declare LckRRN cursor for ",
"select rrn(L) from QRECOVERY/LOCKMYROW L ",
"where rrn(L)=" RRN " for update "
if rc<>0 then do; say sqlcode; exit 98; end;
execsql "open LckRRN" ;
if rc<>0 then do; say sqlcode; exitRC=97; call ClsMB; end;
execsql "fetch LckRRN into :LockedRRN" ;
if rc<>0 then do;
if sqlcode<>100 then say "sqlcode:"sqlcode
exitRC=96; call ClsMB
end;
if sqlcode=100 then do;
say "sqlcode:"sqlcode "sqlerr3:"sqlerr3
exitRC=95
end;
address "*COMMAND",
"wrkjob option(*joblck)"
call ClsMB
exit
ClsMB: procedure expose exitRC
execsql "close LckRRN" ;
if sqlcode=-501 then rc=0
if exitRC<>0 then exit exitRC
if rc<>0 then do; say sqlcode; exit 90; end;
address
return
</code>
Regards, Chuck
As an Amazon Associate we earn from qualifying purchases.