User Tools

Site Tools


close_close_a_data_structure_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== CLOSE (close a data structure) ====== Previous pageReturn to chapter overviewNext page

CLOSE( entity )

blk2blue.jpg

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.

FILE Usage

black.jpg

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

black.jpg

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

black.jpg

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.

REPORT Usage

black.jpg

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

Example:

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)

            END

           END

ViewCust  VIEW(Customer)                     !Declare VIEW structure

          PROJECT(Cus:AcctNumber,Cus:Name)

         END

CODE

OPEN(Customer,22h)

SET(Cus:AcctKey)

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:

OPEN

LOGOUT

ACCEPT

close_close_a_data_structure_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1