Naveen Sharma
New Member
Hi Guys,
I am writing a program where I have a table A which has customer-number field in it. For all customer > 500000 i will have to subtract the customer number by 300000 so that customer number gets changed to 200000. I have taken the customer number in a temp-table.
For each record in this temp-table i will have to change the customer number in table A. Table A primary unique index is not the cutsomer number and a customer number may be repeated mutiple number of times in the table. My code is taking way tooo much time to execute. Need suggestions for a faster execution as there are lakhs of records. Following is an example code snippet:
OUTPUT STREAM sCsv TO VALUE(lv_csvfile).
EXPORT STREAM sCsv DELIMITER "," "Old id" "New id" .
FOR EACH tt-customer WHERE tt-customer.tt-cust-old <> "" EXCLUSIVE-LOCK,
EACH A EXCLUSIVE-LOCK
WHERE A.customer-number = tt-customer.tt-cust-old :
A.customer-number = tt-customer.tt-cust-new NO-ERROR.
IF ERROR-STATUS:ERROR THEN
DO:
capture ERROR AND WRITE IN log
END. /*IF ERROR:STATUS = ERROR THEN DO*/
EXPORT STREAM sCsv DELIMITER "," tt-customer.tt-cust-old A.customer-number .
END. /*for each tt-customer WHERE tt-customer <> */
OUTPUT STREAM sCsv CLOSE.
I am writing a program where I have a table A which has customer-number field in it. For all customer > 500000 i will have to subtract the customer number by 300000 so that customer number gets changed to 200000. I have taken the customer number in a temp-table.
For each record in this temp-table i will have to change the customer number in table A. Table A primary unique index is not the cutsomer number and a customer number may be repeated mutiple number of times in the table. My code is taking way tooo much time to execute. Need suggestions for a faster execution as there are lakhs of records. Following is an example code snippet:
OUTPUT STREAM sCsv TO VALUE(lv_csvfile).
EXPORT STREAM sCsv DELIMITER "," "Old id" "New id" .
FOR EACH tt-customer WHERE tt-customer.tt-cust-old <> "" EXCLUSIVE-LOCK,
EACH A EXCLUSIVE-LOCK
WHERE A.customer-number = tt-customer.tt-cust-old :
A.customer-number = tt-customer.tt-cust-new NO-ERROR.
IF ERROR-STATUS:ERROR THEN
DO:
capture ERROR AND WRITE IN log
END. /*IF ERROR:STATUS = ERROR THEN DO*/
EXPORT STREAM sCsv DELIMITER "," tt-customer.tt-cust-old A.customer-number .
END. /*for each tt-customer WHERE tt-customer <> */
OUTPUT STREAM sCsv CLOSE.