Thanks Rick. I have looked at the sample, and examiled the code. It seems pretty simple when you want it to display the progress while it counts 5 seconds, or whatever you put in the test box. I'm just not sure how to use it when I run my program.
I want the user to click a button which executes the following code:
Procedure loadaudit
Local fn_audit, lnfile_sz, lcString, lcFile
If not used('auditrecords')
Use auditrecords
Endif
* Locate audit files
RELEASE gaAuditfils
gnauditfils = ADIR(gaAuditfils, 'f:\CustBill\Auditfils\*._IE')
IF gnAuditfils>0
* open the text file
FOR numfils=1 TO gnAuditfils
thisfile='f:\CustBill\Auditfils\'+gaAuditfils[numfils,1]
fn_audit = FOPEN(thisfile)
If fn_audit<0
msg('Could not open the audit file')
Return .F.
ENDIF
tfile1='f:\CustBill\Auditfils\'+gaAuditfils[numfils,1]
tfile2='F:\CustBill\Archive\'+gaAuditfils[numfils,1]
* make sure there is something in the file
lnfile_sz = FSEEK(fn_audit,0,2)
If lnfile_sz=0
fn_audit = FCLOSE(fn_audit)
msg('The audit file is empty')
Return .F.
Else
= FSEEK(fn_audit,0,0)
Endif
* process the data
* Do thermo WITH 'setup', 'Processing Audit Trail File'
Do WHILE !FEOF(fn_audit)
lcString = FREAD(fn_audit,254)
m.filenme=thisfile
* parse the record
m.account = substr(lcString, 1, 8)
m.userid = substr(lcString, 9, 8)
m.rectyp = substr(lcString, 17, 1)
m.partner = substr(lcString, 18, 20)
m.groupid = substr(lcString, 38, 18)
m.statflg = substr(lcString, 56, 1)
m.status = substr(lcString, 57, 15)
m.purgflg = substr(lcString, 72, 3)
m.purged = substr(lcString, 75, 15)
m.alias = substr(lcString, 90, 20)
m.priority = substr(lcString, 110, 1)
m.nmsgcls = substr(lcString, 111, 1)
m.msgcls = substr(lcString, 112, 8)
m.msgname = substr(lcString, 120, 8)
m.msgseqi = substr(lcString, 128, 5)
m.systyp = substr(lcString, 133, 8)
m.syslvl = substr(lcString, 141, 4)
m.msgcntr = substr(lcString, 145, 8)
m.msgsize = val(substr(lcString, 153, 8))
m.rcvarch = substr(lcString, 161, 8)
m.snddate = dttime(substr(lcString, 169, 6), substr(lcString, 175, 6))
m.rcvdate = dttime(substr(lcString, 181, 6), substr(lcString, 187,6))
m.seqout = substr(lcString, 193, 6)
* check if the record already exists
If seek(m.groupid, 'auditrecords', 'groupid')
* it does exist - update it
Select auditrecords
Gather memvar
Else
* it does not exist - create it
Insert into auditrecords from memvar
Endif
* Do thermo WITH 'update', lnfile_sz, FSEEK(fn_audit,0,1)
ENDDO
fn_audit = FCLOSE(fn_audit)
RENAME (tfile1) to (tfile2)
ENDFOR
ENDIF
Return .T.
********************************
The code in red is where I'm currently calling an external progress bar, but I'd much rather use the class lib that comes with FoxPro.
Michael