Page 1 of 1

2 SQLs lock the file

Posted: Mon Jun 03, 2024 12:51 pm
by MegumiSawada
Hi,
In my Server Module, Select_Sql command is used to read a file.
When Select_Sql is executed, I believe that target file will be locked(*SHRRD shared lock) and the lock will be released after execution.

However, the file will remain locked by LWEB_JOB if the following conditions are both applied:
1.RPG program is called in Server Module, and that RPG program issues SQL statement
and also
2.Select_Sql is used to read the same file in the same Server Module(same server routine)

If only 1 or only 2, lock will not remain.
Ex.)
SQL is used in RPG but Select_sql is not used in Server module
SQL is not used in RPG and Select_sql is used in Server module
In both cases, lock will be released.

Have you ever experienced this?
If so, how do you work around this?

I appreciate your kind advice.

Best Regards,
Megumi Sawada

Re: 2 SQLs lock the file

Posted: Mon Jun 03, 2024 7:17 pm
by cesarrafael
Hi,
Never had that problem, however you may try to play around with the CRTSQLRPG or CRTSQLRPGI command options e.g. Close SQL cursor(CLOSQLCSR).
Changing command defaults for those commands and compiling again...It may also depend on the sequence they're being executed (first selec_sql and then RPG or the other way around)....

Re: 2 SQLs lock the file

Posted: Tue Jun 04, 2024 6:13 pm
by MegumiSawada
Hi,

Ohhh, I never thought about that! Thank you for your advice. I will try it.

Best Regards,
Megumi Sawada