2 SQLs lock the file

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
MegumiSawada
Posts: 79
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

2 SQLs lock the file

Post 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
cesarrafael
Posts: 32
Joined: Tue Dec 01, 2015 3:44 am

Re: 2 SQLs lock the file

Post 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)....
MegumiSawada
Posts: 79
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

Re: 2 SQLs lock the file

Post by MegumiSawada »

Hi,

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

Best Regards,
Megumi Sawada
Post Reply