Progress
External Program
Interfaces


Using a Library Function That Writes To a Shared Buffer

When you use a CALL statement to invoke a routine that writes to a shared buffer, you must make sure that a transaction is active at the time of the call. For example, place the CALL statement in a DO TRANSACTION block, as shown in the following code fragment:

DEFINE NEW SHARED VARIABLE errcode AS INTEGER.
DEFINE NEW SHARED BUFFER newcust FOR CUSTOMER.
FIND FIRST newcust.

/* 1 */
DO TRANSACTION:
   .
   .
   .
/* 2 */
    CALL HLCROUTINE1.
    IF errcode = 2 THEN DO:
        MESSAGE "Unable to read newcust".
        UNDO, RETRY.
    END.
   .
   .
   .
/* 3 */
END. 

These notes explain the transaction block:

  1. The transaction begins.
  2. The CALL statement is defined.
  3. The transaction ends.

The explicit DO TRANSACTION statement is not the only way to create a transaction in Progress. For example, you create an implicit transaction when you use the UPDATE statement within a FOR EACH block. See the Progress Programming Handbook for more information on transactions.

If your C function calls an HLC library function that writes to a shared buffer, (for example, prowtbc()), and no transaction is active, the library function returns a non-zero return code value that indicates an error has occurred and a Progress error condition results. Use an ON ERROR phrase within your Progress 4GL code to handle Progress error conditions.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095