Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dBASE tagged for Deletion write log file? 1

Status
Not open for further replies.

jwkolker

Programmer
Jan 9, 2003
68
US
Hello:

In dBASE 5 I am wanting to write a logfileddmmyyy.dbf for all records in a table that have been tagged for deletion during the business day before the night routine packs the table and actually removes the records.

1. Want to create a .prg that will recognize all records tagged for deletion and write them to a dbf
2. Want the dbf to be named dynamically like this logfilemmddyyyy.dbf where mmddyyyy is today's date.

Any assistance will be greatly appreciated.

John Kolker

John Kolker
Programmer
jwkolker@comcast.net
 
use MyTable
lcDate = substr(dtos(date()),5,2)+substr(dtos(date()),7,2)+substr(dtos(date()),1,4)
lcTname= "logfile"+lcDate
copy to &lcTname for deleted()
return

You will likely wish to include pathnames in the file name, just add the literals before the "logfile" literal, or set the default path with SET DEFA TO, if the log file is not going to the working directory anyway.

HTH
Dennis
 
Thank you very much it worked like a charm with a few small modifications:

Code:
close all
release all
SET TALK OFF
SET SAFETY OFF
use C:\jkwork\HCDataCleanup\REPORTONDELS\Fees1114
SET DELETED OFF
lcDate = substr(dtos(date()),5,2)+substr(dtos(date()),7,2)+substr(dtos(date()),1,4)
lcTname= "delog"+lcDate
GO TOP
copy to 'C:\jkwork\HCDataCleanup\REPORTONDELS\'+ '&lcTname' for deleted()
use 'C:\jkwork\HCDataCleanup\REPORTONDELS\'+ '&lcTname' exclu
RECALL ALL
CLOSE ALL
RELEASE ALL

Notice that I use the Recall All to return the deleted records in source table to undeleted in the log table.

Thanks again.

You got a tipmaster vote from me bud.

John

John Kolker
Programmer
jwkolker@comcast.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top