Use the CREATE statement after an OPENSEQ statement to create a record in a jBASE directory file or to create a UNIX or DOS file. CREATE creates the record or file if the OPENSEQ statement fails. An OPENSEQ statement for the specified file.variable must be executed before the CREATE statement to associate the pathname or record ID of the file to be created with the file.variable. If file.variable is null, the CREATE statement fails and the program enters the debugger. Use the CREATE statement when OPENSEQ cannot find a record or file to open and the next operation is to be a READSEQ or READBLK.If the first file operation is a WRITESEQ,WRITESEQ creates the record or file if it does not exist. If the record or file is created, it executes the THEN statements; if no record or file is created, it executes the ELSE statements.
Command Syntax
CREATE file.variable {THEN statements [ELSE statements] | ELSE statements}
Example
In the following example, RECORD does not yet exist. When OPENSEQ fails to open RECORD to the file variable FILE, the CREATE statement creates RECORD in the type 1 file DIRFILE and opens it to the file variable FILE.Command Syntax
OPENSEQ 'DIRFILE', 'RECORD' TO FILE ELSE CREATE FILE ELSE ABORT WEOFSEQ FILE WRITESEQ 'SOME DATA' TO FILE ELSE STOP
0 comments:
Post a Comment