| Author |
Message |
sumannaidu
New User
Joined: 21 May 2005 Posts: 13 Location: mumbai
|
|
|
|
| i want a JCL that will compare two files with similar record length and similar fields and create one output file that contains only unmatched records |
|
| Back to top |
|
 |
References
|
Posted: Tue May 06, 2008 6:40 pm Post subject: Re: compare two files and write output file with unmatched recor |
 |
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 3804 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. |
|
| Back to top |
|
 |
ajithgeorvar
New User
Joined: 01 Apr 2005 Posts: 1
|
|
|
|
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
Can we do it with DFSORT? |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 3804 Location: San Jose, CA
|
|
|
|
Ajith,
For the example you show, where there are no duplicates within fileA and no duplicates within fileB, you can use a DFSORT/ICETOOL job like this:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input fileA (FB/80)
//IN2 DD DSN=... input fileB (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/80)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,10,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'A')
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'B')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(81,1,CH,EQ,C'A'),
BUILD=(1,80)
/*
|
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. |
|
| Back to top |
|
 |
|
|
|