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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting entire file 1

Status
Not open for further replies.

Jaytib

Programmer
Sep 7, 2010
19
US
Not good at this, as you can see, I want to read every record in FileA, Chain to FileB and if not found in FileB, delete the record from FileA. but I am deleting the entire file. sounds simple but I cant see my mistake. Please advise.

FFileA UF E K DISK
FFileB IF E K DISK

/Free

Read FileA;
Dow not %Eof(FileA);

Chain (Inv#) FileB; //field from fileA
If not %Found(FileB);
Delete FileARecFmt;
Endif;
Read FileA;
Enddo;

*INLR = *On;
Return;

/End-Free
 
I'll ask the obvious. You are sure that some file a records are in file b?
 
Thanks for responding....It is possible filea records are not in fileb.
If filea records are not in fileb, i want to delete them from filea.
 
Delete by key:

Delete FileARecFmt(Inv#);

I keep trying to do something about my procrastination but I keep putting it off until tomorrow.
 
Thanks, that gets me stuck in a loop. Should I setll on fileb instead of chaining?
 
you might try a set lower limts, but I would do a read equal. My initial question was you are sure that filea, does contain some records that need to be deleted.. so you do have some where the chain "hits"..
 
Thank You for your help! I want to read each record in FileA, chain each record to FileB and if that filea record is not found in FileB, delete the record from FileA.
Filea should always contain records that need to be deleted, but i guess there is the possibility there wouldn't be. Tf the chain doesn't 'hit', should I do a setll on fileb instead of a chain to look for a matching record?
 
do you know how to do a wrkqry, an IBM utility? If so,, go thru that, and pick upi records where the "key" matches,, that way you can be assured that the data is valid.Then you could try a setll and do a reade, and see what happens..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top