How to skip a busy record in batch process - Forum - OpenEdge General - Progress Community

How to skip a busy record in batch process

 Forum

How to skip a busy record in batch process

This question is answered

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

Verified Answer
  • 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.

All Replies
  • 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.

  • Hi,
     
    Sweet! It worked. Thanks!
     
     
    Atentamente,
     
    laacsign75
    Carlos N. García
    IT Manager
    Tel.:        (787) 848-9000 ext 2901
    Fax          (787) 848-0070
     
     
  • Sweet! It worked. Thanks!