OUTPUT BY-REFERENCE can be like OUTPUT APPEND
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
If the ProDataSet parameter is OUTPUT BY-REFERENCE and
the call is local, then any data added to the ProDataSet in the
called procedure is effectively appended to what was already there,
again because both procedures are actually pointing at the same ProDataSet
instance. If you make the same call remotely or you do not make
it BY-REFERENCE, then the target ProDataSet in
the calling procedure is emptied automatically by the AVM before
the data from the OUTPUT parameter is copied into
it. This can give you different behavior between local and remote RUN statements.
OUTPUT parameter BY-REFERENCE,
and do not want APPEND behavior, always explicitly
empty the ProDataSet in the calling procedure just before the call.This might seem like extra overhead, but in fact if you execute
the statement hDataSet:EMPTY-DATASET(), this executes
exactly the same code internally as the AVM uses to empty the ProDataSet
for you, so the net cost is the same. If you do want APPEND behavior, then
include the APPEND keyword on the parameter as
you would for a temp-table.