Navigation:  Reference > Functions >

FileType()

Print this Topic Previous pageReturn to chapter overviewNext page

 

File_Type()

 

PURPOSE

The file_type() function will return the file type in a Char.

 

PARTS

 

1 f/c/eRequired - The file number/handle to be checked.

 

RETURN TYPE - A

 

TYPE   TDFXBC - The type of file being opened.  The options are: T - TAS Professional, D - dBASEIII+ (non-CodeBase), F - Fixed length records (SDF), X - Text type, B - non-TAS Professional Btrieve files and C - Codebase

 

Example

 

filetype:

  define F_type type a size 1

  define data_hndl type i

 

  openv 'data' fnum data_hndl

 

   F_type = file_type(data_hndl)

 

  if F_type = 'C' then msg 'Codebase'

  if f_type = 'T' then msg 'Btrieve'

  if f_type = 'B' Then msg 'Non-Tas Bteive'

  ret

 

define filetype type A size 1
filetype = GET_FILE_TYPE()

if filetype = 'B' // Btrv

  save @bkarcust_hndl nocnf

else_if filetype = 'C' // Codebase

  save @bkarcust_hndl nocnf noclr

endif

 

COMMENTS

The Return Char should correspond to the type option from the open commands.

In some situations you need to know whether the file is Btrieve or CodeBase.  For example, in a SCAN loop, if you have a SAVE command in the loop that is saving records in the file that is being accessed you must use the NOCLR option if this is a CodeBase file.  However, if this is a Btrieve file, the NOCLR option will slow the loop down considerably.  By determining the type of file in your code you can use different SAVE commands for each type of file.

 


Page url: http://www.cassoftware.com/tas/manual/filetype.htm