Buffer <name> may not appear more than once in any dat

Posted by ericg on 16-Sep-2011 17:20

Has the latest 4GL compiler and syntax relieved this issue? I'm on 10.1C.
Compiling the following, will get this error: “Buffer <name> may not appear more than once in any dataset. (11860)”. You cannot put the same buffer in a dataset twice or in more than one dataset at a time.
define temp-table tt1
  field f1 as int.
define dataset ds1 for tt1.
define dataset ds2 for tt1.

All Replies

Posted by Thomas Mercer-Hursh on 16-Sep-2011 17:46

Why do you think it should work?  Seems like a perfectly reasonable limitation to me.  What are you trying to accomplish?

Posted by ericg on 16-Sep-2011 18:11

Why can't the compiler, if this is the situation, force to specify which dataset the common table one is referring to in the code. Something pseudo like:

ASSIGN DATASET ds1:GET-BUFFER-HANDLE(BUFFER tt1:HANDLE:BUFFER-FIELD(1):BUFFER-VALUE) = 77. /* ds1 */

ASSIGN DATASET ds2:GET-BUFFER-HANDLE(BUFFER tt1:HANDLE:BUFFER-FIELD(1):BUFFER-VALUE) = 88. /* ds2 */

I think one can do this (common table in multiple datasets) in ADO.NET.

Posted by Thomas Mercer-Hursh on 16-Sep-2011 18:21

If you did a FILL() on one dataset, what would you expect to happen to

the other one? If you overrode any of the FILL related methods on one

and overrode them differently on the other dataset, what would you

expect to happen? If you marked TRACKING-CHANGES on one, but not the

other, what would you expect to happen?

What is your use case?

Posted by ericg on 16-Sep-2011 18:36

To clarify, the table tt1 may have the same structure but is in different memory spaces (the two datasets).

Posted by Thomas Mercer-Hursh on 16-Sep-2011 19:08

Then you want two TT definitions, but you could make the second one LIKE.  A PDS isn't a separate memory space.  It is just a wrapper on one or more temp-tables.  Define one table and put it in two PDSs, were you allowed, and there would only be one table, not two.

Posted by Admin on 17-Sep-2011 02:07

externalresearch schrieb:

Has the latest 4GL compiler and syntax relieved this issue? I'm on 10.1C.
Compiling the following, will get this error: “Buffer may not appear more than once in any dataset. (11860)”. You cannot put the same buffer in a dataset twice or in more than one dataset at a time.
define temp-table tt1
  field f1 as int.
define dataset ds1 for tt1.
define dataset ds2 for tt1.

I think the error message is pretty clear: A buffer may not appear in more than a single dataset.

Define an additional buffer for the temp-table and you'll be fine:

define temp-table tt1

  field f1 as int.

DEFINE BUFFER b_tt1 FOR tt1        .

define dataset ds1 for tt1.

define dataset ds2 for b_tt1.

Posted by ericg on 19-Sep-2011 11:11

Thanks Mike. Yes that is possible. I was hoping to use an common include file that had the temp-table definition, but I could pass in a parameter to the include so to differentiate the table name. Ultimately I was hoping to not have to do this and have the same temp-table name in both datasets. But I guess that's not possible with the latest 4GL version. Additionally this has a situation where the OpenClient ProxyGen can only create one dataset definition if two have the same structure, even if the table name is different, so ProxyGen seems to pick one. I've talked to PSI about this and they are aware of it.

Posted by Thomas Mercer-Hursh on 19-Sep-2011 12:01

You can have the same table name and definition as long as the PDSs are in two different compile units.  If they are in the same compile unit, then they have to have different names because that name is a direct connection to a block of memory for that table.  This is the key issue here and one very unlikely to change with version.  Whatever might be the case in other languages, for ABL the design decision was that a PDS is a wrapper with some additional properties and behavior on one or more temp-tables and the temp-tables have their own independent identity just as they have always had from before there were PDSs.  What you want is only meaningful if the TT is nothing more than a definition and the PDS provides the actual implementation of the whole thing.

This thread is closed