Handling uninitialized prodataset and temp-table when using

Posted by jquerijero on 06-Nov-2015 15:44

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) 

All Replies

Posted by Tim Kuehn on 06-Nov-2015 15:47

This is a bug - log it with tech support.

Posted by Frank Meulblok on 09-Nov-2015 03:35

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.

Posted by Lars Neumeier on 09-Nov-2015 03:57

Did you tried the following? (adding the BIND)

METHOD VOID doSomething(OUTPUT DATASET ds BIND): END METHOD.

Posted by Mike Fechner on 09-Nov-2015 04:03

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.

Posted by jquerijero on 09-Nov-2015 10:15

I will verify it in 11.5. The last one I checked is 11.4.

This thread is closed