I am currently developing some code to assist testers. This is happening on MVOn, but will need to be ported to UV once I'm done with it.
In a loop, the program calls various other subroutines, which eventually call executable binaries EG
TheCMd = "DOS /c 'c:\OurApps\Pcl2Pdf32 ":FilePath:BatchID:' ':FilePath:PdfID:"'"
The sequence of events is (or should be)
1) Generate PCL in &HOLD&
2) Convert to PDF, with output to another folder (IE the &HOLD& entry is retained)
3) Move from one folder to another
For (3) I have a command like
DOS /C MOVE D:\MyFolder\bob1.pdf D:\MyFolder\sub1\sub2\anotherName.pdf
This mostly works, doesn't always. If I test with the same set of data over and over again, it will always fail on the same files.
If I do this
DosCmd = "DOS /C MOVE D:\MyFolder\bob1.pdf D:\MyFolder\sub1\sub2\anotherName.pdf" RETURNING TheStat CAPTURING Results
TheStat is ALWAYS zero, whether the file was moved or not.
In the case when the file was NOT moved, results will read
0 file(s) moved.
The process cannot access the file because it is being used by another process.
There are no READU locks set. If I trap the command output, write it out and look for non-printable characters, there aren't any.
So it seems that some process outside of MVon (in this case) or UniVerse has the file open and thus renders it unmoveable.
Now there might be ways to handle this (I have tried a crude SLEEP 10, before the MOVE, but that didn't help) if I could see what was locking the file, or could clear what I presume is some sort of lock (I don't have supervisor rights). Just looping around, waiting for the MOVE to eventually work doesn't achieve anything.
Say there are 14 PDFs to be generated for the test, it will always be the same files that produce a problem. EG I run a test and the 2nd and 7th files (as we loop) give this error. I go and do something else for half an hour, repeat the test, and 2 and 7 fail again.
I tried changing the names of the files that I am working with, thinking that maybe some other process at some other time had locked a file with the same name, but this has made no difference. So I presume - but can't prove - that it is the program that converts the PCL to PDF. I don't have the source code for that program.
Does anybody have any ideas as to how I can determine what is preventing the file being moved or even clear the lock? Please remember that although I'm working in MVOn right now, I have to port the code to UniVerse (on Windows).