Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You need to give more details of what you want to do.
Please show an example of the records in each input file (relevant fields only) and what you expect for output. If input file1 can have duplicates within it, show that in your example. If input file2 can have duplicates within it, show that in your example. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of each input file.
I too was interested in knowing how to use DFSORT and write out unmatched records.
Say there are 2 files File A and File B of which first 10 chars is key data. We need to find the records in File A which arent in File B or vice versa (means unmatched).
Data in File A (80chars long):
1111111111 RECORD1XXXXXXXXXXXXXXXXXXXXXXX
2222222222 RECORD2YYYYYYYYYYYYYYYYYYYYYYYYYY
Data in File B (80chars long):
1111111111 RECORD1AAAAAAAAAAAAAAAAAAAAAAA
3333333333 RECORD2BBBBBBBBBBBBBBBBBBBBBBB
The output file if its Records in A, but not in B need to have:
2222222222 RECORD2YYYYYYYYYYYYYYYYYYYYYYYYYY
If you do have duplicates within either input file, show a better example of the records in each input file for that situation and what you expect for output.
I want generate two files ,one file contains all records from file A which key are different from file B's key.
another file contains all recoreds from file A and file B which records have the same key in file B.
SO the first output file should as below:
2222222222AAAAAAAAAAAAAAAAAA
2222222222BBBBBBBBBBBBBBBBBB
3333333333AAAAAAAAAAAAAAAAAA
the second output file should as below:
1111111111AAAAAAAAAAAAAAAAAA
1111111111BBBBBBBBBBBBBBBBBB
1111111111CCCCCCCCCCCCCCCCCC
1111111111DDDDDDDDDDDDDDDDDD
1111111111FFFFFFFFFFFFFFFFFF
4444444444AAAAAAAAAAAAAAAAAA
4444444444CCCCCCCCCCCCCCCCCC
I hope I made my requirement clear. how can it be done by DFSORT? thanks a lot for your help!!
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
That thread was from 2008. Today, we would probably use DFSORT's JOINKEYS function for this. For details on how to do various matching operations with JOINKEYS, see the "Create files with matching and non-matching records" Smart DFSORT Trick at:
If you need more specific, help show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
Also, run this job and show the //SYSOUT messages you receive, so we can see what level you're at: