|Navigation: Language Reference > 13 - Built-in Functions >====== CLOSE (close a data structure) ======|
CLOSE( entity )
|CLOSE||Closes a data structure.|
|entity||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.
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.
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.
APPLICATION and WINDOW Usage
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.
56 LOGOUT active
Customer FILE,DRIVER('Clarion'),PRE(Cus) !Declare customer file layout
ViewCust VIEW(Customer) !Declare VIEW structure
OPEN(ViewCust) !Open the customer view
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