Consultor Eletrônico



Kbase 43321: User-Defined Functions and Key Fields in ASSIGN Statement
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
Solution ID: P13321

FACT(s) (Environment):

Progress 8.3x
Progress 9.x

SYMPTOM(s):

Attempt to reference user-defined function '<function>' in an ASSIGN type statement after an assignment to key field '<fieldname>'. (7955)

CAUSE:

The following example using the Order and Order-Line tables of the sports database illustrates the cause of error 7955:

ASSIGN order-line.order-num = order.order-num
  order-line.backorder = myFunction().

Assigning a key field in any statement before a reference to a user-defined function in that same statement has been found to cause index corruption or give run-time error messages in older Progress versions.
Fixing the problem by allowing the above assignment was considered too risky for the product stability, therefore we now forbid the assignment altogether at compile time with error 7955.

FIX:

To avoid this situation, either:

1) Move all key field assignments after all user-defined function references in the ASSIGN statement:

   ASSIGN order-line.backorder = myFunction()
    order-line.order-num = order.order-num.

2) Do all key field assignments in a separate ASSIGN statement:

   ASSIGN order-line.order-num = order.order-num.
  ASSIGN order-line.backorder = myFunction().