CLOSE (close a data structure)

Top  Previous  Next


CLOSE( entity )


Closes a data structure.


The label of a FILE, VIEW, APPLICATION, WINDOW, or REPORT structure.

CLOSE terminates processing on the active entity. Any memory used by the active entity is released when it is closed.

FILE Usage

CLOSE(file) closes an active FILE. Generally, this flushes DOS buffers and frees any memory used by the open file other than the RECORD structure's data buffer. If the file is a member of a transaction set, error 56 (LOGOUT active) is posted.

VIEW Usage

CLOSE(view) closes an active VIEW. A VIEW declared within a procedure is implicitly closed upon RETURN from the procedure, if it has not already been explicitly CLOSEd. If the CLOSE(view) statement is not immediately preceded by a REGET statement, the state of the primary and secondary related files in the VIEW are undefined. The contents of their record buffers are undefined and a SET or RESET statement may be required before performing sequential processing on the file.


CLOSE(window) closes an active APPLICATION or WINDOW structure. Memory used by the active window is released when it is closed and the underlying screen is automatically re-drawn. When a window is closed, if it is not the top-most window on its execution thread, all windows opened subsequent to the window being closed are automatically closed first. This occurs in the reverse order from which they were opened. An APPLICATION or WINDOW that is declared local to (within) a PROCEDURE is automatically closed when the program RETURNs from the procedure.


CLOSE(report) closes an active REPORT structure, which prints the last page FOOTER (unless the last structure printed has the ALONE attribute) and any required group FOOTER strautures, and closes the REPORT. If the REPORT has the PREVIEW attribute, all the temporary metafiles are deleted. RETURN from a procedure in which a REPORT is opened automatically closes the REPORT.

Errors Posted:

56   LOGOUT active


Customer    FILE,DRIVER('Clarion'),PRE(Cus) !Declare customer file layout

AcctKey     KEY(Cus:AcctNumber)

Record       RECORD

AcctNumber    LONG

OrderNumber   LONG

Name          STRING(20)

Addr          STRING(20)

City          STRING(20)

State         STRING(20)

Zip           STRING(20)




ViewCust  VIEW(Customer)                     !Declare VIEW structure






OPEN(ViewCust)                              !Open the customer view

 !executable statements

CLOSE(ViewCust)                             !and close it again


CLOSE(Customer)                             !Close the customer file

CLOSE(MenuScr)                              !Close the menu screen

CLOSE(CustEntry)                            !Close customer data entry screen

CLOSE(CustRpt)                              !Close the report


See Also: