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
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.

Post Reply