CreateFile is used to create a new FileType Object organized by this Object. The created file can be written using the Write Method of the FileType.

Signature

CreateFile(

[in] String fileName

[in] Boolean requestFileOpen

[out] NodeId fileNodeId

[out] UInt32 fileHandle

);

Argument

Description

fileName

The name of the file to create. The name is used for the BrowseName and DisplayName of the file object and also for the file in the file system.

For the BrowseName, the fileName is used for the name part of the QualifiedName. The namespace index is Server specific.

For the DisplayName, the fileName is used for the text part of the LocalizedText. The locale part is Server specific.

requestFileOpen

Flag indicating if the new file should be opened with the Write and Read bits set in the open mode after the creation of the file. If the flag is set to True, the file is created and opened for writing. If the flag is set to False, the file is just created.

fileNodeId

The NodeId of the created file Object.

fileHandle

The fileHandle is returned if the requestFileOpen is set to True.

The fileNodeId and the fileHandle can be used to access the new file through the FileType Object representing the new file.

If requestFileOpen is set to False, the returned value shall be 0 and shall be ignored by the caller.

Method Result Codes (defined in Call Service)

Result Code

Description

Bad_BrowseNameDuplicated

See OPC 10000-4 for a general description. A file with the name already exists.

Bad_UserAccessDenied

See OPC 10000-4 for a general description.

Table C.10 specifies the AddressSpace representation for the CreateFile Method.

Table C.10 – CreateFile Method AddressSpace Definition

Attribute

Value

BrowseName

CreateFile

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

HasProperty

Variable

InputArguments

Argument[]

PropertyType

Mandatory

HasProperty

Variable

OutputArguments

Argument[]

PropertyType

Mandatory