home *** CD-ROM | disk | FTP | other *** search
- *:*********************************************************************
- *:
- *: Procedure file: D:\FOX2\FM\INSTALL\SB_SELEC.PRG
- *:
- *: System: FoxMasters install
- *: Author: Braunstein
- *: Copyright (c) 1992, Tetra
- *: Last modified: 04/06/92 14:56
- *:
- *: Set by: INITALIZE() (function in FMINSTAL.PRG)
- *: : GETFMLOC() (function in SMOVER.PRG)
- *:
- *: Calls: SB_CLOSE.PRG
- *:
- *: Documented 04/06/92 at 15:18 FoxDoc version 2.10b
- *:*********************************************************************
- *
- * sb_selec.prg
- *
- * to open (without reopening) a file
- * and select the index order
- *
- *
- FUNCTION sb_selec
-
-
- PARAMETERS location, dbf_name, idx_name, new_alias, modifyer
-
- * | | | | |
- * drive + | | | | |
- * subdirectory database index alias | use command
- * where file name tag name (if not modifyer such
- * located filename) as EXCLUSIVE
- *
- *
- * set up memory variables as private
- SELECT 0
- PRIVATE ;
- location , ;
- dbf_name , ;
- idx_name , ;
- new_alias , ;
- modifyer , ;
- ret_val
-
-
- *
- * operate with the presumption that the file
- * will be successfully opened, and the order
- * successfully set. change to .f. when fails.
- *
- STORE .T. TO ret_val
- *
- * convert names to standard format
- *
- * fix the location name (parameter required)
- IF !EMPTY(location)
- *
- * fix text
- STORE TRIM(UPPER(location)) TO location
- *
- * fix format ie. dr:\subdir\
- IF RIGHT(location,1) # '\'
- *
- * add backslash as required
- STORE location + '\' TO location
- ELSE
- *
- * name already includes backslash,
- * no action required
- *
- ENDIF right(location,1) # '\'
- *
- ELSE
- *
- * reduce chances of it getting in the way
- STORE '' TO location
- *
- ENDIF !EMPTY(location)
- *
- * fix the dbf_name (parameter required)
- STORE TRIM(UPPER(dbf_name)) TO dbf_name
- *
- * fix the idx_name
- IF PARAMETERS() > 2
- STORE TRIM(UPPER(idx_name)) TO idx_name
- ELSE
- STORE '' TO idx_name
- ENDIF PARAMETERS() > 2
- *
- * fix the new alias name
- IF PARAMETERS() > 3
- STORE TRIM(UPPER(new_alias)) TO new_alias
- ELSE
- STORE '' TO new_alias
- ENDIF PARAMETERS() > 3
- *
- * fix the modifyer
- IF PARAMETERS() > 4
- STORE TRIM(UPPER(modifyer)) TO modifyer
- ELSE
- STORE '' TO modifyer
- ENDIF PARAMETERS() > 4
- *
- * test for exsistence of a open files modifyer,
- * if there is one, just open the files
- *
- IF EMPTY(modifyer)
- *
- * test for file already open,
- * if it is, just change the order and proceed
- *
- * determine current file status
- DO CASE
- CASE ALIAS() = new_alias .AND. !EMPTY(new_alias)
- *
- * file selected, change master index
- * make sure an index is desired before opening it
- IF EMPTY(idx_name)
- *
- * no index desired
- SET ORDER TO 0
- *
- ELSE
- *
- * check to see if already in desired order
- IF ORDER() # idx_name
- *
- * Make change to desired order when necessary
- SET ORDER TO TAG (idx_name)
- *
- ELSE
- *
- * already in desired order, no action required
- *
- ENDIF ORDER() # idx_name
- ENDIF EMPTY(idx_name)
- *
- CASE ALIAS() = dbf_name
- *
- * file selected, change master index
- * make sure an index is desired before opening it
- IF EMPTY(idx_name)
- *
- * no index desired
- SET ORDER TO 0
- ELSE
- *
- * check to see if already in desired order
- IF ORDER() # idx_name
- *
- * Make change to desired order when necessary
- SET ORDER TO TAG (idx_name)
- *
- ELSE
- *
- * already in desired order, no action required
- *
- ENDIF ORDER() # idx_name
- ENDIF EMPTY(idx_name)
- *
- CASE USED("&new_alias") .AND. !EMPTY(new_alias)
- *
- * file open in an unselected work area
- SELECT (new_alias)
- *
- * file selected, change master index
- *
- * make sure an index is desired before opening it
- IF EMPTY(idx_name)
- *
- * no index desired
- SET ORDER TO 0
- ELSE
- *
- * check to see if already in desired order
- IF ORDER() # idx_name
- *
- * Make change to desired order when necessary
- SET ORDER TO TAG (idx_name)
- *
- ELSE
- *
- * already in desired order, no action required
- *
- ENDIF ORDER() # idx_name
- ENDIF EMPTY(idx_name)
- *
- *
- CASE USED("&dbf_name")
- *
- * file open in an unselected work area
- SELECT (dbf_name)
- *
- * file selected, change master index
- *
- * make sure an index is desired before opening it
- IF EMPTY(idx_name)
- *
- * no index desired
- SET ORDER TO 0
- ELSE
- *
- * check to see if already in desired order
- IF ORDER() # idx_name
- *
- * Make change to desired order when necessary
- SET ORDER TO TAG (idx_name)
- *
- ELSE
- *
- * already in desired order, no action required
- *
- ENDIF ORDER() # idx_name
- ENDIF EMPTY(idx_name)
- *
- *
- OTHERWISE
- *
- * file not open
- * test for exsistence before opening
- STORE location + dbf_name + '.DBF' TO temp_name
- IF FILE("&temp_name")
- *
- * set up flag to interact with sb_err
- STORE .T. TO sb_selec
- *
- * open the file
-
- SELECT 0
- IF EMPTY(new_alias)
- USE (location) + (dbf_name) ALIAS (dbf_name)
- ELSE
- USE (location) + (dbf_name) ALIAS (new_alias)
- ENDIF EMPTY(new_alias)
- *
- * test for successful file opening
- IF !sb_selec
- STORE .F. TO ret_val
- ELSE
- *
- * if file selected, change master index
- * make sure an index is desired before opening it
- IF EMPTY(idx_name)
- *
- * no index desired
- SET ORDER TO 0
- ELSE
- *
- * check to see if already in desired order
- IF ORDER() # idx_name
- *
- * Make change to desired order when necessary
- SET ORDER TO TAG (idx_name)
- *
- ELSE
- *
- * already in desired order, no action required
- ENDIF ORDER() # idx_name
- ENDIF EMPTY(idx_name)
- ENDIF !sb_selec
- *
- ELSE
- *
- * file not located, message
- WAIT WINDOW ' FILE, ' + dbf_name + ' NOT FOUND! '
- *
- * function failed
- STORE .F. TO ret_val
- *
- ENDIF FILE("&temp_name")
- *
- *
- ENDCASE
- *
- * open file with modifyer
- ELSE
- *
- *
- * first, test for exsistence before opening
- STORE location + dbf_name + '.DBF' TO temp_name
- IF FILE("&temp_name")
- *
- * second, close file
- * (no way to tell what the current condition is and change it)
- *
- IF EMPTY(new_alias)
- *
- * close using filename
- DO sb_close WITH dbf_name
- *
- * open with modifyer, use dbf_name as alias
- SELECT 0
- STORE location + dbf_name + ' ALIAS ' + dbf_name + modifyer TO t_file
- USE (t_file)
- *
- ELSE
- *
- * close using the new_alias name
- DO sb_close WITH new_alias
- *
- * open with new modifyer and new alias
- SELECT 0
- STORE location + dbf_name + ' ALIAS ' + new_alias + modifyer TO t_file
- USE (t_file)
- *
- ENDIF EMPTY(new_alias)
- *
- * set the appropriate order
- *
- * make sure an index is desired before opening it
- IF EMPTY(idx_name)
- *
- * no index desired
- SET ORDER TO 0
- ELSE
- *
- * check to see if already in desired order
- IF ORDER() # idx_name
- *
- * Make change to desired order when necessary
- SET ORDER TO TAG (idx_name)
- *
- ELSE
- *
- * already in desired order, no action required
- *
- ENDIF ORDER() # idx_name
- ENDIF EMPTY(idx_name)
- *
- ELSE
- *
- * file not located, message
- WAIT WINDOW ' FILE, ' + dbf_name + ' NOT FOUND! '
- *
- * function failed
- STORE .F. TO ret_val
- *
- ENDIF FILE("&temp_name")
- ENDIF EMPTY(modifyer)
- *
- * go back with the news
- RETURN ret_val
- *
- * end of sb_selec.prg
- *
- *: EOF: SB_SELEC.PRG
-