CREATE |
![]() ![]() ![]() |
The CREATE statement creates an empty directory file record after a previous OPENSEQ has reported that the record did not exist.
Format
CREATE file.var {ON ERROR statement(s)} {THEN statement(s)} {ELSE statement(s)}
where
The ON ERROR clause is taken in the event of a fatal error that would otherwise cause the program to abort.
At least one of the THEN and ELSE clauses must be present. The THEN clause is executed if the operation is successful. The ELSE clause is executed if the CREATE operation fails.
Example
OPENSEQ 'AUDIT', DATE() TO SEQ.F ELSE IF STATUS() THEN ABORT 'Error opening audit record' CREATE SEQ.F ELSE ABORT 'Error creating audit record' END ELSE SEEK SEQ.F, 0, 2 END
This program fragment attempts to open a sequential file record. If the OPENSEQ fails because the record does not exist, an empty record is created. |