[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-------+##################################################################
#+-| CLOSE |-------------------------------------------+######################
#| +-------+ CLOSE command closes designated files and |######################
#| releases all memory allocated to them |######################
#+-----------------------------------------------------+######################
##############################################################################
##############################################################################
#+--| Syntax |--------------------------------------------+###################
#| [!<Alias>] CLOSE ALL || ALTERNATE || DATABASES |###################
#| || INDEX || <Alias> |###################
#+--------------------------------------------------------+###################
##############################################################################
##############################################################################
#########+---| Description |-----------------------------------------+########
#########| CLOSE ALTERNATE |########
#########| |########
#########| Closes the current alternate file and turns the SET |########
#########| ALTERNATE flag go OFF. |########
#########| --------------------------------------------------------- |########
#########| CLOSE ALL |########
#########| |########
#########| Closes all files, including any file opened with the |########
#########| low-level buffered file function, f_open(). |########
#########| --------------------------------------------------------- |########
#########| CLOSE DATABASES |########
#########| |########
#########| Closes all database files and associated index files. |########
#########| --------------------------------------------------------- |########
#########| [!<Alias>] CLOSE INDEX |########
#########| |########
#########| Closes all index files for the current or selected alias. |########
#########| --------------------------------------------------------- |########
#########| CLOSE <Alias> |########
#########| |########
#########| Closes the specified <Alias> database and associated |########
#########| index files. |########
#########+-----------------------------------------------------------+########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Open two databases and close both with one command. |#########
#########| |#########
#########| USE "first.dbf" ALIAS first INDEX fname |#########
#########| SELECT 2 |#########
#########| USE "second.dbf" ALIAS second |#########
#########| |#########
#########| SET ALTERNATE TO "tmp.txt" |#########
#########| SET ALTERNATE ON |#########
#########| |#########
#########| CLOSE ALL && Closes first.dbf, then |#########
#########| && its associated index |#########
#########| && file, second.dbf |#########
#########| && and the alternate |#########
#########| && file tmp.txt. |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Use a database with an index and then |#########
#########| * close the index. |#########
#########| |#########
#########| USE "first.dbf" ALIAS first INDEX findex |#########
#########| SET ALTERNATE TO "tmp.txt" |#########
#########| SET ALTERNATE ON |#########
#########| |#########
#########| SEEK my_name |#########
#########| |#########
#########| CLOSE INDEX && Close the index alias |#########
#########| && findex. The database |#########
#########| && first.dbf and the |#########
#########| && alternate file tmp.txt |#########
#########| && are still open |#########
#########| |#########
#########| !findex CLOSE INDEX && This syntax is also |#########
#########| && acceptable. |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * Use a database with an index and an alternate |#########
#########| * file, closing only the alternate file. |#########
#########| |#########
#########| USE "first.dbf" ALIAS first INDEX findex |#########
#########| SET ALTERNATE TO "tmp.txt" |#########
#########| SET ALTERNATE ON |#########
#########| |#########
#########| CLOSE ALTERNATE && Closes only the |#########
#########| && alternate file. |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 4 |-------------------------------------------+#########
#########| * CLOSE DATABASES and CLOSE ALL are similar. |#########
#########| * CLOSE ALL also closes an alternate file. |#########
#########| |#########
#########| OPEN "first.dbf" ALIAS first INDEX findex |#########
#########| OPEN "second.dbf" ALIAS second INDEX sindex |#########
#########| OPEN "third.dbf" ALIAS third INDEX tindex |#########
#########| |#########
#########| SET ALTERNATE TO "tmp.txt" |#########
#########| SET ALTERNATE ON |#########
#########| |#########
#########| . |#########
#########| . |#########
#########| . |#########
#########| |#########
#########| CLOSE DATABASES && Leaves the |#########
#########| && alternate file open. |#########
#########| |#########
#########| ? "This will enter the alternate file" |#########
#########| CLOSE ALTERNATE |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 5 |-------------------------------------------+#########
#########| * An alias can be a parameter to a function or |#########
#########| * procedure. This is a generic "See if the |#########
#########| * database exists and if not, create it with |#########
#########| * at least one record" procedure. |#########
#########| |#########
#########| PROCEDURE make_ind |#########
#########| PARAMETERS ALIAS dbf_alias |#########
#########| |#########
#########| IF .NOT. exist( a_dbf( dbf_alias )) |#########
#########| BUILD dbf_alias FROM ALIAS dbf_alias |#########
#########| ENDIF |#########
#########| OPEN dbf_alias ALIAS dbf_alias |#########
#########| !dbf_alias APPEND BLANK |#########
#########| CLOSE dbf_alias |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
FLUSH
INDEX
OPEN
SET ALTERNATE
SET INDEX TO
USE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson