OpenEdge 11.6 - ERROR - COPY-DATASET must have a valid datas

Posted by atuldalvi123 on 19-Sep-2018 06:38

Hello Guys,

I am facing this issue when I call below code in a loop. For first 20 or 30 executions below code works but after that it throws an error in AppServer log. 

Below is the sample code and its running on AppServer -

************************************************ Start *********************************************************

DEFINE INPUT        PARAMETER iEmpNo AS INTEGER   NO-UNDO.

DEFINE TEMP-TABLE ttSal no-undo

    FIELD EmpNo AS Int.
    FIELD SalAmnt AS Dec.

DEFINE VARIABLE hSalNdl AS HANDLE  NO-UNDO.

DEFINE dsSal FOR ttSal.

*** Class objCom object Definition & initialization  ***************

objCom:getData(INPUT iEmpNo, OUTPUT DATASET-HANDLE hSalNdl).

DATASET dsSal:COPY-DATASET(hSalNdl,FALSE, FALSE, TRUE).

******************************************************** End **************************************************

Pls help

All Replies

Posted by Matt Gilarde on 19-Sep-2018 06:52

Can you provide a complete example which can be compiled and demonstrates the issue? Please don't retype the code in your post. Copy and paste it. There are several errors in the code you posted.

It seems that at some point getData returns an invalid handle in hSalNdl (it may be the unknown value). Have you debugged the code to see what is happening in getData just before the error occurs?

Posted by Fernando Souza on 19-Sep-2018 08:55

A question I have about this code is whether you are deleting the dataset returned as hSalNdl once you are done with it, since you are getting a copy of it every time. You might be running out of memory at some point.

Posted by atuldalvi123 on 24-Sep-2018 03:45

Yes, I am deleting handle hSalNdl once I am done with it just to avoid memory leak but still facing that issue.

Pls suggest.

Posted by Mike Fechner on 24-Sep-2018 03:48

When reusing the variable hSalNdl after DELETE OBJECT it's advised to ASSIGN hSalNdl  = ? .

Posted by atuldalvi123 on 24-Sep-2018 03:54

The program call is in loop and that variable hSalNdl is defined in the program only.

Still it needs to assign ? initially before we use it ?

Posted by frank.meulblok on 24-Sep-2018 05:04

Another question springs to mind for this thread.

The  source dataset handle hSalNdl which triggers the error gets set in this line:

objCom:getData(INPUT iEmpNo, OUTPUT DATASET-HANDLE hSalNdl).

Have you confirmed if that method call always returns a valid dataset ?

Posted by frank.meulblok on 24-Sep-2018 05:04

Another question springs to mind for this thread.

The  source dataset handle hSalNdl which triggers the error gets set in this line:

objCom:getData(INPUT iEmpNo, OUTPUT DATASET-HANDLE hSalNdl).

Have you confirmed if that method call always returns a valid dataset ?

Posted by jquerijero on 24-Sep-2018 09:45

Can you post the appserver log error entry? Just wondering if there are some other errors.

This thread is closed