Try OpenEdge Now
skip to main content
ProDataSet Parameters : Passing a ProDataSet with BY-REFERENCE or BIND : Passing a ProDataSet parameter by reference : OUTPUT BY-REFERENCE can be like OUTPUT APPEND
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.
When you pass an 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.