Thread: General

Easytrieve match two files - is SEARCH the right tool?

Started by Derek • user3 replies184 viewsLast activity 4 weeks ago
Post #1
1 votes
Derek
Reputation
204
Posts: 6
Joined: Sep 16, 2024, 7:55 AM
Posted: Jul 17, 2026, 1:18 PM

Inherited a program that GET file1, then SEARCH through all of file2 looking for a hit, every time. Runs forever on real volumes.

Someone muttered "synchronized JOB" or "two-file match." What should this actually look like?

Post #2
0 votes
James
Reputation
524
Posts: 30
Joined: May 2, 2024, 8:00 AM
Posted: Jul 17, 2026, 5:18 PM

Nested full scan of file2 is the worst option. Sort both on the key and do a proper match/merge with GET on each side under JOB INPUT NULL, or use synchronized file processing if both are in key order:

JOB INPUT (FILE1 KEY(ACCT) FILE2 KEY(ACCT))
then IF MATCHED / IF FILE1 / IF FILE2 logic.

Files must be ascending on those keys.

Post #3
0 votes
Derek
Reputation
204
Posts: 6
Joined: Sep 16, 2024, 7:55 AM
Posted: Jul 18, 2026, 7:18 PM

Synced JOB cut runtime from 40 minutes to under 2. Reviewers were right to hate the old code.

You must be signed in to reply to this thread