When using BIND, prodataset and temp-table remain uninitialized unless the source program touches (create a temp-table) them.
If you want to keep the prodataset and temp-table empty, you will need to create a dummy record and delete it. Is there a way to check if the prodataset is still uninitialized because the source program has been called yet? And also, is there a way to force the initialization without creating and deleting a dummy temp-table record?
EXAMPLE:
Source.cls
SomeMethod(OUTPUT ds):
/* if SomeMethod doesn't create any temp-table, the output ds will remain uninitialized */
END METHOD.
Consumer.cls
src = NEW Source()
src:SomeMethod(OUTPUT ds BIND)
This is a bug - log it with tech support.
What release are you on ?
4GLtrace + temp-table logging shows that in OE 11.5.1 and OE 11.6, it temp-tables get instantiated at end of "SomeMethod", immediately before the BIND occurs.
Did you tried the following? (adding the BIND)
METHOD VOID doSomething(OUTPUT DATASET ds BIND): END METHOD.
I use bind in the following way:
The class that needs to BIND to another classes DATASET, defines the DATASET and TEMP-TABLE's BY-REFERENCE.
The handle of the temp-table (not TABLE-HANDLE) is passed as a parameter to the constructor of that class. In the constructor I do this - after that I can access the temp-table from any method.
CONSTRUCTOR PUBLIC XyzClass (phDataset AS HANDLE): SUPER (INPUT phDataset). BindDataset (DATASET-HANDLE phDataset BIND) . END CONSTRUCTOR. /*------------------------------------------------------------------------------ Purpose: Do nothing, just receive the parameter and bind to the received Dataset reference Notes: Invoked from the class constructor @param dsObjectType DATASET to bind to ------------------------------------------------------------------------------*/ METHOD PRIVATE VOID BindDataset (DATASET dsObjectType BIND): /* NOOP */ END METHOD.
I will verify it in 11.5. The last one I checked is 11.4.