Ah, Programming Guide > File Processign > Synchronized Fiel Processing >
Synchronized File Input > Record Availability
The example they give is three files with keys:
FILE1 FILE2 FILE3
1 2 1
2 3 A 3
3 A 3 B 4
3 B 4 A 5
8 A 4 B 7
8 B 6 8 A
9 7 8 B
where the key is the number (1, 2, 3 etc.) and the letter is non-key data.
And the result is:
JOB FILE1 FILE2 FILE3
ITERATION RECORD RECORD RECORD
1 1 N/A 1
2 2 2 N/A
3 3A 3A 3
4 3A 3B N/A
5 3B N/A N/A
6 N/A 4A 4
7 N/A 4B N/A
8 N/A N/A 5
9 N/A 6 N/A
10 N/A 7 7
11 8A N/A 8A
12 8A N/A 8B
13 8B N/A N/A
14 9 N/A N/A
The basic rule for Easytrieve file sync is you ALWAYS want to go one-to-many,
if at all possible. This is because when you have many-to-one, the key in the
first file will greedily match the keys in the second file, but then all of the
remaining equal-keys in the first file are orphans. Same for many-to-many: one
record in the first file matches, the rest do not.
In the above example what happens for key 3 is:
We get a match for all three files: record 3A in files 1 and 2, and record 3 in
file 3:
> JOB FILE1 FILE2 FILE3
> ITERATION RECORD RECORD RECORD
> 3 3A 3A 3
Now the 3A record in file 2 will attempt to match against more key 3 in file 3.
There are none.
So now the 3A record in file 3 will attempt to match against more key 3 in file
2. There is one: record 3 B:
> 4 3A 3B N/A
Here we don’t still have key 3 in file 3, because the previous match used it
up, so now record 3B in file 2 is an orphan *compared to file 3*.
Are there any other key 3's in file 2? No.
So now we move on to the next key 3 in file 1, which is an orphan:
> 5 3B N/A N/A
The above example shows whether the file records are available or not. I'd look
into the other statuses in each interation:
- MATCHED or not
- FIRST-DUP, NOT DUPLICATE, or LAST-DUP
-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of
Pierre Fichaud
Sent: Tuesday, November 7, 2023 10:46 AM
To: [email protected]
Subject: Re: Easytrieve Synchronized File Processing (SFP)
It's documented in the Easytrieve Report Generator 11.6 in the section on
Synchronized File Processing.
I have a requirement to do a 3-way merge.
Pierre.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN