>******************************************************************** >* Description.......: TestAppend - checks append for few records, so user may identify, if table structure needs to be changed >* Calling Samples...: if TestAppend(m.lcFileName,'delimited with tab') >* Parameter List....: tcFileName, tcType >* Created by........: Idea - Sergey Berezniker >* Modified by.......: Nadya Nosonovsky 12/31/2001 01:16:20 PM >******************************************************************** >lparameter tcFileName, tcType >if vartype(m.tcFileName)"C" && invalid parameter passed > return .f. >endif >if vartype(m.tcType)"C" && invalid second parameter passed > tcType = "delimited with tab" && Default type of the file >endif >local lnHandle, lcBuffer, llReturn >lnHandle = FOPEN(m.tcFileName) >llReturn = .f. >if m.lnHandle > 0 && File is opened > lcBuffer = FREAD(m.lnHandle, 32*1024) && 32K > FCLOSE(m.lnHandle) >* Get read of the last incomplete record > lcBuffer = LEFT(m.lcBuffer, RAT( CHR(13)+CHR(10), m.lcBuffer) - 1) > =Strtofile( m.lcBuffer, 'tempfile.txt') > && Assumes, what the table to append is currently active > append from tempfile.txt &tcType > delete file tempfile.txt > browse > llReturn = messagebox('Do appended records look correctly? If yes, will now append the whole file...',36,'Check append...') = 6 && Yes >endif >return m.llReturn