两个错误
(1)file_name没有定义变量。(字符型)
(2)Write!LOCK!中间加逗号。
FileOpen ( filename {, filemode {, fileaccess {, filelock {, writemode { creator, filetype }}}}} )
Argument Description
filename A string whose value is the name of the file you want to open. If filename is not on the current directory's relative search path, you must enter the fully qualified name.
filemode (optional) A value of the FileMode enumerated type that specifies how the end of a FileRead or FileWrite is determined. Values are:?LineMode! ?(Default) Read or write the file a line at a time?StreamMode! ?Read the file in 32K chunksFor more information, see Usage below.
fileaccess
(optional) A value of the FileAccess enumerated type that specifies whether the file is opened for reading or writing. Values are:?Read! ?(Default) Read-only access?Write! ?Write-only accessIf PowerBuilder does not find the file, a new file is created if the fileaccess argument is set to Write!
filelock (optional) A value of the FileLock enumerated type specifying whether others have access to the opened file. Values are:?LockReadWrite! ?(Default) Only the user who opened the file has access?LockRead! ?Only the user who opened the file can read it, but everyone has write access?LockWrite! ?Only the user who opened the file can write to it, but everyone has read access?Shared! ?All users have read and write access.
writemode (optional) A value of the WriteMode enumerated datatype. When fileaccess is Write!, specifies whether existing data in the file is overwritten. Values are:?Append! ?(Default) Write data to the end of the file?Replace! ?Replace all existing data in the fileWritemode is ignored if the fileaccess argument is Read!
Return value
Integer. Returns the file number assigned to filename if it succeeds and -1 if an error occurs. If any argument's value is null, FileOpen returns null.