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
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?
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.
Yes, I am deleting handle hSalNdl once I am done with it just to avoid memory leak but still facing that issue.
Pls suggest.
When reusing the variable hSalNdl after DELETE OBJECT it's advised to ASSIGN hSalNdl = ? .
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 ?
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 ?
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 ?
Can you post the appserver log error entry? Just wondering if there are some other errors.