Reputation: 241
I am new to progress 4GL. I have exported some data as a CSV file format using progress 4GL. The issue I am facing is If I run the program for the first time then CSV file is created but if I run another program by keeping CSV file open on my machine then the data is not written to the same CSV file. Instead it is giving error. I want to use one CSV(sample.csv) file for storing the data from multiple programs.
If it is possible to write the data by keeping CSV file open on my machine then tell me the way or else I want to find that if the file is open(sample.csv) then I need to give a message to a user that "pls close CSV file".
The program I tried from my side. The error I got is attached.
OUTPUT TO "C:\Users\ast\Pictures\Saved Pictures\sample.csv".
EXPORT DELIMITER ";" "CustNum" "Name".
FOR EACH customer NO-LOCK:
EXPORT DELIMITER ";" Cust-Num Name.
END.
OUTPUT CLOSE.
Upvotes: 0
Views: 377
Reputation: 3374
You cannot write to the file since Excel (in this case) has a lock on the file.
You can catch the error - it's number is shown in your error message:
output to c:\temp\foo.csv.
put unformatted 'lockme'.
output close.
catch e as progress.lang.error:
if e:getMessageNum(1) = 98 then
message 'please close the file' view-as alert-box.
else
undo, throw e.
end catch.
Upvotes: 2