CSV file locked even after csv_close()

Scott Klement's tool for processing CSV files in an RPG program. http://www.scottklement.com/csv/
Post Reply
iDevDaly
Posts: 5
Joined: Fri Jan 21, 2022 5:23 pm

CSV file locked even after csv_close()

Post by iDevDaly »

I have written a program to process csv files from the /QNTC files system and load the data into DB2 on i tables. When processing the files in an ILE RPG program, after reading through the file I execute the csv_close() procedure and then set on LR and exit the program. In the ILE CL program that called the RPG, I then attempt to move the file to an archive folder, but the MOV command is failing with error CPFA09E ("Object in use.").

When I process more than one file at a time, all of the subsequent files are processed and moved to the archive folder successfully. But I can never get the first file to move. I don't understand (a) what is using the file, and (b) why the csv_close() procedure call doesn't "unlock" the file so I can move it.

EDIT: The lock on the IFS file is only released after the user signs off of the emulation session which called the initial CL driver program.


Any assistance would be appreciated.

Michael
peder udesen
Posts: 15
Joined: Thu Jul 29, 2021 8:00 am

Re: CSV file locked even after csv_close()

Post by peder udesen »

Have you found the cause to the problem?
Please tell us if you found what happened.

Otherwise here are 2 links that might help you.

https://www.rpgpgm.com/2015/07/checking ... s-and.html
https://www.ibm.com/support/pages/findi ... e-system-0
Post Reply