<file name>: Parameter 2: The name of the file in which the specified block or specified data is
to be added.
Type: STRING
The absolute path can be specified before the actual file name. If a path is not
specified, the file is searched for in the current directory (= directory of selected
program).
Rules regarding path data, see "Addressing program memory files (Page 554)".
<ExtG>: If the data is to be output to an external device/file using the "Process DataShare"
function, then the symbolic identifiers for the external device/file to be opened must
be specified instead of the file name.
Type: STRING
For further information, see "Process DataShare - Output to an external device/file
(EXTOPEN, WRITE, EXTCLOSE): (Page 997)".
Note:
The identifier must be identical to the identifier specified in the EXTOPEN command.
<block/data>: Parameter 3: The block or data to be added to the specified file.
Type: STRING
Note
When writing to the passive file system or to an external program memory, the WRITE
command implicitly inserts an "LF" character (LINE FEED = new line) at the end of the output
string.
This behavior does not apply for output to an external device/file using the "Process
DataShare" function. If an "LF" is also to be output, then this must be explicitly specified in the
output string.
→ also refer to example 3: Implicit/explicit "LF"!
Supplementary conditions
● Maximum file size (→ machine manufacturer)
The maximum possible file size of log files in the passive file system is set with the machine
data:
MD11420 $MN_LEN_PROTOCOL_FILE
The maximum file length is applicable for all files created using the WRITE command in the
passive file system. If it is exceeded, an error message is output and the block or data is not
saved. If there is sufficient free memory, a new file can be created.
Examples
Example 1: WRITE command into the passive file system without absolute path data
Program code Comment
N10 DEF INT ERROR ; Definition of error variables.
N20 WRITE(ERROR,"PROT","LOG FROM 7.2.97") ; Write the text "LOG FROM 7.2.97"
to file _N_PROT_MPF.
N30 IF ERROR ;Error evaluation.
Work preparation
3.5 File handling
NC programming
566 Programming Manual, 12/2019, 6FC5398-2EP40-0BA0