I have this batch process that serves as a data switching station between an OE DB in UNIX and MS SQL (back and forth). While there is no one in SQL locking the record it works fine. The batch runs every 5 minutes and its logic is very simple: a FOR EACH looking the SQL records and if it meets the condition they are copied to UNIX, after this the records are marked in SQL as posted. But if, by coincidence, a user from the SQL side traps the record my batch process gets stuck sending and error message to the limbo hanging the program. This condition locks the system forcing my to abort the batch process.
My question is: how can I skip a record if it is busy and proceed with the next one? I have tried different approaches without success (EXCLUSIVE-LOCK, ERROR-STATUS, CATCH).
Any idea will be appreciated.
Rgds/Carlos Garcia
def buffer alt-record for record.
/* for each no-lock */
for each record no-lock:
/* lock the record without waiting using an alternate buffer */
find alt-record where rowid(alt-record) = rowid(record) excluisve-lock no-wait no-error.
if locked alt-record
then do:
/* report error */
next.
end.
end.
def buffer alt-record for record.
/* for each no-lock */
for each record no-lock:
/* lock the record without waiting using an alternate buffer */
find alt-record where rowid(alt-record) = rowid(record) excluisve-lock no-wait no-error.
if locked alt-record
then do:
/* report error */
next.
end.
end.
Sweet! It worked. Thanks!