Script Function :WRITE_PROCESS with parameter APPEND fails if file does not exist

Document ID : KB000085057
Last Modified Date : 14/04/2018
Show Technical Document Details
Issue:
Error Message :
U02000221 Unable to open Text file ' c:\temp\meine_datei_0.txt ', reason: '2 - The system cannot find the file specified.'.

Using a script function :WRITE_PROCESS does not work as expected when the file to append to does not exist.
 
:SET &HND# = PREP_PROCESS_REPORT()
:set &write# = write_process(&HND#,"c:\temp\file_0.txt",WIN01,”LOGIN.ALL”,APPEND) 

If the file c:\temp\file_0.txt file does not exist, the above error message is displayed.the append function only works if the file already exists. The expected behavior is that :WRITE_PROCESS will create the file if needed.
Environment:
OS Version: N/A
Cause:
Cause type:
Defect
Root Cause: A new file should be created if it doesn't exist and a write_process function should be used with the parameter APPEND.
Resolution:
Update to a fix version listed below or a newer version if available.

With this fix, a new file is created if it doesn't exist and the :WRITE_PROCESS function is used with the parameter APPEND.


Fix Status: Released

Fix Version(s):
Automation Engine 12.1.0 - Available
Automation Engine 12.0.2 - Available
Additional Information:
Workaround :
Check to ensure the file listed in the  :PREP_PROCESS_FILENAME exists, and if it does not, create it before calling :WRITE_PROCESS script function.