View Full Version : unlock table created on SQL
03-19-2003, 01:09 PM
My guess is that the program never closed the file. Is *INLR being set on? You can run RCLRSC in your CLP if you prefer. Dave
03-20-2003, 06:06 AM
LR was set on and I also have rclrsc in my program, but its still locked by the previous job. I cant think of a way to close the file created by SQL. What I did is I created the file to QTEMP to avoid this file locking. Thanks. Sky
03-21-2003, 06:36 AM
It's great using QTEMP solved the problem for you. But could this have been a case where Un-Committed Transactions were keeping the File Locked? If Commitment Control Parameter was *RR for example, according to the Help: *RR Specifies the objects referred to in SQL ALTER, COMMENT ON, CREATE, DROP, GRANT, LABEL ON, and REVOKE statements and the rows selected, updated, deleted, and inserted are locked until the end of the unit of work (transaction). Uncommitted changes in other jobs cannot be seen. All tables referred to in SELECT, UPDATE, DELETE, and INSERT statements are locked exclusively until the end of the unit of work (transaction).
03-21-2003, 07:54 AM
I have tried that and several other parameters but I got the message "Member MTDSLS01 not journaled to journal *N." and no records has been inserted to the table thats why I used 2=NC. Thanks Sky
03-24-2003, 02:38 PM
If the program is keeping the file open when it ends, try using the SQL statement CLOSE in your program.
03-25-2003, 04:56 AM
I dont used cursor on my SQL thats why I cant close my table. Sky
03-25-2003, 10:42 AM
Have you tried changing the commitment control parameter when you compile the program to *NONE ?
03-25-2003, 12:48 PM
Yes, there still lock, but what I did was to put the program in activation group and rclactgrp *elligible on CLLE to free the table from lock status. Thanks for you response. Sky
03-26-2003, 05:01 AM
This should be set to *ENDMOD to close the SQL cursor on exiting the program. Otherwise you need to delete the activation group i.e. signoff if the program uses the default activation group.
03-26-2003, 06:49 AM
I wrote an RPGIV program and embedded an SQL statement, I run the program and it created a table and inserted data on it but when I tried to run the program on my other session, my job hanged because the file was still locked by my other job which already finished running. Do I need to used QTEMP for this. How to create a table with sharing and without lock using SQL statements. Thanks In Advance. Sky <hr width=50 align=left>Code ('http://www.mcpressonline.com/mc/showcode@@.6ae61ce2')
03-26-2003, 06:49 AM
Well, I have already done that but still doesnt solved my problem since I am not using sql cursor in my program. Putting it in activation group seems to work fine. I think setting commitment control to *none during compilation and rclrsc will also do the trick. Thanks. Sky
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.