Hi,
Our application updates the database records based on a flat file. This file contains a long char chain, containing the code of the update (C<reate>, M<odify>, D<elete>), the table to be updated and the field values in succession. This application is running in every 10 minutes in working hours and operating for several years. Some times we received the lock table overflow error message, but then usually it was caused by other users or batches locking too many records. Yesterday evening it seemed there was neither other batch running nor a user connecting to the database, however, this message appeared. Based on the archived files it seems that in that particular case the application had to process a huge amount of lines, that would explain why the error occurred.
But what I'd like to know is why the locks are not released in such a situation, if the code is edited well (I suppose it is).
See the program:
REPEAT:
CREATE <workfile>.
IMPORT STREAM <stream> <workfile>.
IF <workfile>.table_name = "orders" THEN DO:
RUN create_order.
DELETE <workfile>.
NEXT.
END.
IF <workfile>.table_name = "order_lines" THEN DO:
RUN create_line.
DELETE <workfile>.
NEXT.
END.
.
.
.
END.
PROCEDURE create_order:
IF <workfile>.code = "C" THEN DO:
CREATE orders.
ASSIGN orders.d_creinv = INT(SUBSTR(<workfile>.wf-zone_champs,89,8))
orders.numordjou = INT(SUBSTR(<workfile>.wf-zone_champs,97,4)).
END.
ELSE DO: /* code = "M" or "D" */
FIND FIRST orders
WHERE orders.d_creinv = INT(SUBSTR(<workfile>.wf-zone_champs,89,8))
AND ordres.numordjou = INT(SUBSTR(<workfile>.wf-zone_champs,97,4))
NO-ERROR.
END.
IF <workfile>.code = "D" THEN DO:
DELETE orders.
END.
ELSE DO: /* code = "C" or "M" */
IF <workfile>.code = "C" OR
AVAILABLE orders THEN DO:
ASSIGN
orders.idcompte = INT(SUBSTR(<workfile>.wf-zone_champs,1,3))
orders.idclient = INT(SUBSTR(<workfile>.wf-zone_champs,4,6))
.
.
.
orders.idlieu = INT(SUBSTR(<workfile>.wf-zone_champs,125,3)).
END.
END.
RELEASE orders.
END PROCEDURE.
As far as I know each transaction ends at the bottom of the repeat loop. Should the locks then not be released?
Thanks in advance,
Peter
Our application updates the database records based on a flat file. This file contains a long char chain, containing the code of the update (C<reate>, M<odify>, D<elete>), the table to be updated and the field values in succession. This application is running in every 10 minutes in working hours and operating for several years. Some times we received the lock table overflow error message, but then usually it was caused by other users or batches locking too many records. Yesterday evening it seemed there was neither other batch running nor a user connecting to the database, however, this message appeared. Based on the archived files it seems that in that particular case the application had to process a huge amount of lines, that would explain why the error occurred.
But what I'd like to know is why the locks are not released in such a situation, if the code is edited well (I suppose it is).
See the program:
REPEAT:
CREATE <workfile>.
IMPORT STREAM <stream> <workfile>.
IF <workfile>.table_name = "orders" THEN DO:
RUN create_order.
DELETE <workfile>.
NEXT.
END.
IF <workfile>.table_name = "order_lines" THEN DO:
RUN create_line.
DELETE <workfile>.
NEXT.
END.
.
.
.
END.
PROCEDURE create_order:
IF <workfile>.code = "C" THEN DO:
CREATE orders.
ASSIGN orders.d_creinv = INT(SUBSTR(<workfile>.wf-zone_champs,89,8))
orders.numordjou = INT(SUBSTR(<workfile>.wf-zone_champs,97,4)).
END.
ELSE DO: /* code = "M" or "D" */
FIND FIRST orders
WHERE orders.d_creinv = INT(SUBSTR(<workfile>.wf-zone_champs,89,8))
AND ordres.numordjou = INT(SUBSTR(<workfile>.wf-zone_champs,97,4))
NO-ERROR.
END.
IF <workfile>.code = "D" THEN DO:
DELETE orders.
END.
ELSE DO: /* code = "C" or "M" */
IF <workfile>.code = "C" OR
AVAILABLE orders THEN DO:
ASSIGN
orders.idcompte = INT(SUBSTR(<workfile>.wf-zone_champs,1,3))
orders.idclient = INT(SUBSTR(<workfile>.wf-zone_champs,4,6))
.
.
.
orders.idlieu = INT(SUBSTR(<workfile>.wf-zone_champs,125,3)).
END.
END.
RELEASE orders.
END PROCEDURE.
As far as I know each transaction ends at the bottom of the repeat loop. Should the locks then not be released?
Thanks in advance,
Peter