prathap_ts Warnings : 1 New User
Joined: 07 May 2005 Posts: 9 Location: Duluth, US
|
|
|
|
conditions
output 1 should contain unique records from input 1 and 2 based on last 5 digits
15abc12345
15ggd11111
15hsr22222
15asd98765
16trh44444
16utt55555
output 2 should contain duplicate records from input 1 and 2 based on last 5 digits (only 2nd occurance)
16xyz12345
16gdf98765
output 3 is made of first two bytes , last five bytes of duplicates records (say output 2) plus few more new fields like name1 and field1
1612345 name1 field1
1698765 name2 field2
leave the new fields... below output is ok in file 3
1612345
1698765
thanks in advance. |
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Pratap_ts,
The following DFSORT JCL will give you the desired results. I assumed that your both files are of the same lrecl and recfm.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your input file1,DISP=SHR
// DD DSN=Your input file2,DISP=SHR
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//OUT3 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(6,5,PD,A),EQUALS
OUTREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(6,5))
OUTFIL FNAMES=OUT1,INCLUDE=(81,8,ZD,EQ,1),BUILD=(1,10)
OUTFIL FNAMES=OUT2,INCLUDE=(81,8,ZD,GT,1),BUILD=(1,10)
OUTFIL FNAMES=OUT3,INCLUDE=(81,8,ZD,GT,1),BUILD=(1,2,6,5)
/* |
|
|