One Star

File lock on AS400 not clearing

I'm still somewhat new to TOS (currently using 4.1.0.M3_r46036) and need some assistance. I have a job that is waiting for an AS400 file to have 0 rows in it. I'm using a tWaitForSqlData object. When the row count hits 0, the job continues and loads new data into the file. After successfully loading new data, an tAS400Row object is called to call a program on the AS400 which does some work then uses a "clear" to clear the file for reuse. My problem is that the AS400 clear command cannot proceed because the job has a lock on the file. I've tried multiple methods to close the connection and free the lock prior to calling the AS400 program but have not been successful. The AS400 programmer would prefer to use the clear command to clear the file over using a delete. Any suggestions on how to clear the lock would be helpful. Please see attached screen shot.
3 REPLIES
Six Stars

Re: File lock on AS400 not clearing

does mysqldata correctly release the lock?
have you also tried to force a "commit" after?
What does the WRKOBJLCK shows? type of lock?
One Star

Re: File lock on AS400 not clearing

emaxt6 - thank you for the reply. As of this morning, the process seems to be running. The file lock on the 400 is clearing. I double checked the program flow I currently have is the same as the one provided above and it is. I know something has changed but neither the AS400 programmer nor I can identify it "yet".
To answer your questions: 1) we're not using MySQL; 2) I did try a commit after each of the calls to the AS400 and that did not change the outcome; 3) WRKOBJLCK was showing the file was locked by the JDBC process that Talend was using; 4) file level lock.
Obviously, it would be ideal to have a single connection connection to the AS400 for efficiency but it appears the file locking will be an issue. I'm still open to any suggestions to get back to a shared connection. Any thoughts or suggestions are welcomed.
Six Stars

Re: File lock on AS400 not clearing

Sorry I mistyped... by mysqldata I meant waitsqldata... are you sure that it doesn't kick in in some way producing a lock after or while you put data? or maybe it was a spurious connection left over by some killed job... but ok now seems working...
yes a single connection across the job is usually preferred;
anyway sometimes is very important to tune the transaction isolation of the jdbc connection; in some cases I found that strange things could happen when also RPG program are involved.
For example sometimes I needed to put in Talend as400 JDBC parameters the string "prompt=false;transaction isolation=none" forcing the connection to avoid transaction processing to let things work with some RPG native programs.
in case you need to work with as400 and jdbc see this page for additional properties:
http://javadoc.midrange.com/jtopen/com/ibm/as400/access/doc-files/JDBCProperties.html
bye