Consultor Eletrônico



Kbase P165343: 4GL/ABL: Is there a way to use a variable with EXCEPT list of the BUFFER-COMPARE statement?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/12/2010
Status: Unverified

GOAL:

4GL/ABL: Is there a way to use a variable with EXCEPT list of the BUFFER-COMPARE statement?

GOAL:

What would happen if a variable is used with EXCEPT list of the BUFFER-COMPARE statement?

GOAL:

Can a variable be used for the EXCEPT list of the BUFFER-COMPARE() method?

GOAL:

Sample code using a variable for the EXCEPT list of the BUFFER-COMPARE statement?

GOAL:

Sample code using a variable for the EXCEPT list of the BUFFER-COMPARE() method?

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

There is NO way to successfully use a variable with EXCEPT list of the BUFFER-COMPARE statement. Using a variable to store the EXCEPT list of the BUFFER-COMPARE statement causes the AVM to ignore the EXCEPT list, compare all fields and generate the runtime (5379). On the other hand, a variable may be used to store the fields of the EXCEPT list of the BUFFER-COMPARE() method.
The following 4GL/ABL procedure demonstrates the above described behavior of both the the BUFFER-COMPARE statement and the BUFFER-COMPARE() method:
DEFINE TEMP-TABLE ttCustomer NO-UNDO LIKE Customer.
DEFINE VARIABLE hSourceBuffer AS HANDLE NO-UNDO.
DEFINE VARIABLE hTargetBuffer AS HANDLE NO-UNDO.
DEFINE VARIABLE lDoBuffersMatch AS LOGICAL NO-UNDO.
DEFINE VARIABLE cExceptionList AS CHARACTER NO-UNDO.
FIND FIRST Customer NO-LOCK.
BUFFER-COPY Customer TO ttCustomer.
ASSIGN
cExceptionList = 'Name,Balance'
ttCustomer.Name = 'Some New Name'
ttCustomer.Balance = 10000.
/* With the BUFFER-COMPARE statement, the AVM ignores the except-list variable, issues warning (5379) and compares all fields */
BUFFER-COMPARE Customer EXCEPT cExceptionList TO ttCustomer SAVE lDoBuffersMatch.
MESSAGE 'Static:' lDoBuffersMatch
VIEW-AS ALERT-BOX TITLE "BUFFER-COMPARE Statement ignores exception list stored in a variable".
ASSIGN
hSourceBuffer = BUFFER Customer:HANDLE
hTargetBuffer = BUFFER ttCustomer:HANDLE
/* With the BUFFER-COMPARE() method, the AVM honors the except-list variable and compares the non excluded fields only */
lDoBuffersMatch = hTargetBuffer:BUFFER-COMPARE(hSourceBuffer, '', cExceptionList).
MESSAGE 'Dynamic:' lDoBuffersMatch
VIEW-AS ALERT-BOX TITLE "BUFFER-COMPARE()method honors the exception list stored in a variable".