Progress
Language Reference
BUFFER-COMPARE Statement
Performs a bulk comparison of two records (source and target) by comparing source and target fields of the same name for equality and storing the result in a field. You can specify a list of fields to exclude, or a list of fields to include. You can also specify WHEN...THEN phrases. For all such phrases you specify, Progress evaluates the WHEN portion, and if it evaluates to TRUE, Progress executes the THEN portion.
SYNTAX
source
The source database table, buffer, temporary table, or work table.
EXCEPT field
A list of source fields to exclude from the bulk compare.
USING field
A list of source fields to include in the bulk compare. The USING option is a positive version of the EXCEPT option.
TO target
The target database table, buffer, temporary table, or work table.
SAVE RESULT IN result-field
A variable or field to contain the result of the comparison. The variable or field must be CHARACTER or LOGICAL.
If result-field is CHARACTER, the result is a comma-separated list of fields that failed the comparison, sorted in ascending order.
If result-field is LOGICAL, the result is YES if all fields are equal, or NO if any fields are unequal. In either case, BUFFER-COMPARE stops comparing when it encounters the first inequality.
EXPLICIT COMPARES
Opens a block of WHEN options. If you open the block, you must close it with END COMPARES.
NO-ERROR
Diverts any error messages from this statement to the ERROR-STATUS system handle and records the success of this statement in ERROR-STATUS:ERROR.
WHEN field
Any data field in the source.
BUFFER-COMPARE removes this field from a USING list or adds this field to an EXCEPT list. This removes the field from the bulk compare and from result-field.
compare-operator
Represents one of the following: LT, LE, GT, GE, EQ, NE, MATCHES, BEGINS, or CONTAINS.
expression
Any valid Progress expression.
THEN statement-or-block
Any Progress statement or block. The statement or block executes when the WHEN clause evaluates to TRUE.
END COMPARES
Closes the block of WHEN phrases.
NOTES
- At compile time, BUFFER-COMPARE:
- Complains if any source-target field pair is not type compatible
- An example of such a pair is a field named "Limit" in the source and in the target that is LOGICAL in the source but DECIMAL in the target.
- Excludes from the bulk comparison all EXCEPT field fields and all WHEN field fields
- Automatically excludes from the bulk comparison fields that appear in the source but not in the target
- Tries to bind unqualified field names that appear in the EXCEPT and USING options to the source buffer
- At run time, BUFFER-COMPARE:
- Compares all fields not in the EXCEPT phrase and all fields not in the WHEN phrase for equality
- Stores the result in the field that the SAVE phrase specifies, if any
NOTE: This behavior is different from the behavior of the Progress 4GL CASE statement, which executes only the first WHEN option whose condition evaluates to TRUE.- Evaluates each WHEN option, executing it if its condition evaluates to TRUE
SEE ALSO
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |