View previous topic :: View next topic
|
Author |
Message |
skrishnavijay
New User
Joined: 26 Sep 2007 Posts: 25 Location: chennai
|
|
|
|
Hi all,
I have the following requirement.
There are two files with some similar records(say file A has more records then file B). My intention is to get those records which are in file A and NOT in file B (i..e.. A - B).
Krishna |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Krishna,
You haven't given enough information.
Please show an example of the records in each input file (relevant fields only) and what you expect for the output records. If input fileA can have duplicates within it, show that in your example. If input fileB can have duplicates within it, show that in your example.
Give the starting position, length and format of the relevant fields.
Give the RECFM and LRECL of each input file. |
|
Back to top |
|
|
skrishnavijay
New User
Joined: 26 Sep 2007 Posts: 25 Location: chennai
|
|
|
|
File 1:
LRECL=80, (1,21,CH,A) Key position
000000000000000000024|........
000000000000000000132|........
000000000000000000024|........
000000000000000001879|........
000000000000000002134|........
000000000000012084883|........
000000000000000321833|........
000000000000000002134|........
000000000000000032156|........
File 2:
LRECL=80, (34,21,CH,A) Key position
..............................000000000000000000024|........
..............................000000000000000000132|........
..............................000000000000000000024|........
..............................000000000000000001879|........
..............................000000000000000002134|........
..............................000000000000000321833|........
..............................000000000000012084883|........
here File2 is subset of File1. I want records in File1 and NOT in File2.
I need to concern about Key field only and both file1 and file2 have duplicates.
Hope I am clear.
Thanks in advance,
Krishna |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Not really.
I assume you're matching by key, not by relative record number ... right?
It would have helped if you'd showed what you expect for output as I asked you to. Do you just expect this record from File1 for output?
000000000000000032156|........
If you have multiple records with the same key in file1 without a match in file2, do you want all of those file1 records for output, or just one of them.
For example, if file1 had:
000000000000000000892|........
000000000000000000892|........
000000000000000000892|........
would you want all three records for output or just one? |
|
Back to top |
|
|
skrishnavijay
New User
Joined: 26 Sep 2007 Posts: 25 Location: chennai
|
|
|
|
Thanks for your patience.
I forgot to mention that my input & output files are fixed length(FB 80)
Yes.
As you said I want one of the records(duplicates) in file1 those doesn't have a match in file2 (I want the full record from file1)
Also we are using SYNCSORT. Could you please help me in this regard ?
Thanks in advance,
Krishna |
|
Back to top |
|
|
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
skrishnavijay,
Please check with the following code for for your requirement.
Code: |
// EXEC PGM=SORT
//SORTJNF1 DD *
000000000000000000024|........
000000000000000000132|........
000000000000000000024|........
000000000000000001879|........
000000000000000002134|........
000000000000012084883|........
000000000000000321833|........
000000000000000002134|........
000000000000000032156|........
/*
//SORTJNF2 DD *
.................................000000000000000000024|........
.................................000000000000000000132|........
.................................000000000000000000024|........
.................................000000000000000001879|........
.................................000000000000000002134|........
.................................000000000000000321833|........
.................................000000000000012084883|........
/*
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,21,A)
JOINKEYS FILE=F2,FIELDS=(34,21,A)
JOIN UNPAIRED,F1,ONLY
SORT FIELDS=(1,21,CH,A)
SUM FIELDS=NONE
/*
// |
Output:
Code: |
000000000000000032156|........ |
|
|
Back to top |
|
|
skrishnavijay
New User
Joined: 26 Sep 2007 Posts: 25 Location: chennai
|
|
|
|
Thanks a lot Shankar......!!
You are very helpful... Its working gr8.......!!!
Thanks,
Krishna |
|
Back to top |
|
|
|