Document Templates : DGL Statements : File Handling Statements : OPEN Statement

OPEN Statement

Statement Syntax:

OPEN (fl, file_name, mode [, status]);

where fl is an identifier of type FILE and mode is either INPUT or OUTPUT.

This statement is used with mode=OUTPUT to open a file or the dialog area so that a subsequent WRITE statement can pass text to it, and with mode=INPUT for subsequent READ statements. The statement assigns a value to fl.

The dialog area is frequently opened to pass run-time messages to it. To open the dialog area, use the string ‘DIALOG’ (with the apostrophes) for the file_name.

Optionally, you may include the status function code status which returns the value stm_success upon successful execution of the statement.

If the file opened for output does not exist, this statement creates a new file.

If the file exists, it is initialized by the OPEN statement; i.e., the written information overwrites the existing contents of the file.