INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Deleting entire file

Deleting entire file

(OP)
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

RE: Deleting entire file

I'll ask the obvious. You are sure that some file a records are in file b?

RE: Deleting entire file

(OP)
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.

RE: Deleting entire file

Delete by key:

Delete FileARecFmt(Inv#);

I keep trying to do something about my procrastination but I keep putting it off until tomorrow.

RE: Deleting entire file

(OP)
Thanks, that gets me stuck in a loop. Should I setll on fileb instead of chaining?

RE: Deleting entire file

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"..

RE: Deleting entire file

(OP)
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?

RE: Deleting entire file

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..

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close