Made a modification to a routine I use to transfer records from one table ("statdtpt") to another ("arcdtpt"). I then, delete redundant records from "statdtpt". I recently opted to use the code below to rid the use of "SCATTER" - which by the way worked fine. It would be simple enough to go back to the old method, but my curious nature is getting the better of me.
The function below works. However, very sporadic. Records are being transferred most of the time (verified), but from time to time, the "pushError" routine (writes error to error table) is called; suggesting a problem. Happens with some regularity.
The calling program sets the passing variable "arcXcde" - numeric and <9,999,999,999. The field "xcde" is defined as n(10).
Things to note:
- Program written using VFP9.0 SP2
- Both table structures are identical (verified several times)
- When I manually run the routine I am unable to get it to fail... Likely meaningless due to sporadic nature of routine.
What am I missing?
FUNCTION xTransferRecords
LPARAMETERS arcXcde
LOCAL rflag
TRY
INSERT INTO arcdtpt ;
SELECT * FROM statdtpt WHERE xcde = arcXcde
DELETE FOR xcde = arcXcde IN statdtpt
rflag = .T.
CATCH
DO pushError WITH 'Unable to Archive DTPT records.', 'archive'
rflag = .F.
ENDTRY
RETURN rflag
The function below works. However, very sporadic. Records are being transferred most of the time (verified), but from time to time, the "pushError" routine (writes error to error table) is called; suggesting a problem. Happens with some regularity.
The calling program sets the passing variable "arcXcde" - numeric and <9,999,999,999. The field "xcde" is defined as n(10).
Things to note:
- Program written using VFP9.0 SP2
- Both table structures are identical (verified several times)
- When I manually run the routine I am unable to get it to fail... Likely meaningless due to sporadic nature of routine.
What am I missing?
FUNCTION xTransferRecords
LPARAMETERS arcXcde
LOCAL rflag
TRY
INSERT INTO arcdtpt ;
SELECT * FROM statdtpt WHERE xcde = arcXcde
DELETE FOR xcde = arcXcde IN statdtpt
rflag = .T.
CATCH
DO pushError WITH 'Unable to Archive DTPT records.', 'archive'
rflag = .F.
ENDTRY
RETURN rflag