useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
Hi,
I Have two files(record lenght of both the file is 16, and key is 1-10)
file 1 is as below.
FILE!:
Date(1-8)depot(9-10) Time(11-16)
20110905 D1 130024
20110905 D2 140018
20110905 D3 140026
20110905 D4 150001
for each key of file 1 there will be a multiple entry in the file 2(with the different time).
Date(1-8)depot(9-10) Time(11-16)
20110905 D1 120014
20110905 D1 120088
20110905 D1 130061
20110905 D1 130091
20110905 D2 130018
20110905 D2 140077
20110905 D2 140093
20110905 D3 140020
20110905 D3 140023
20110905 D3 140081
20110905 D4 140088
20110905 D4 150011
20110905 D4 150083
20110905 D4 150088
i want to fetch only those records from file2 which has time in (position 11-16) greater than time(1-16) in File1 .
so my output file should be as below.
File3:
Date(1-8)depot(9-10) Time(11-16)
20110905 D1 130061
20110905 D1 130091
20110905 D2 140077
20110905 D2 140093
20110905 D3 140081
20110905 D4 150011
20110905 D4 150083
20110905 D4 150088
can this be achieved using dfsort?.
regds,
useit |
|
kratos86
Active User
Joined: 17 Mar 2008 Posts: 148 Location: Anna NGR
|
|
|
|
Hello,
Yes it can be achieved. Try this
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF2 DD *
20110905D1130024
20110905D2140018
20110905D3140026
20110905D4150001
//SORTJNF1 DD *
20110905D1120014
20110905D1120088
20110905D1130061
20110905D1130091
20110905D2130018
20110905D2140077
20110905D2140093
20110905D3140020
20110905D3140023
20110905D3140081
20110905D4140088
20110905D4150011
20110905D4150083
20110905D4150088
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,10,A)
JOINKEYS FILE=F2,FIELDS=(1,10,A)
REFORMAT FIELDS=(F1:1,17,F2:1,17)
SORT FIELDS=COPY
INCLUDE COND=(11,6,ZD,GT,28,6,ZD)
OUTREC BUILD=(1,17)
/* |
output -
Code: |
20110905D1130061
20110905D1130091
20110905D2140077
20110905D2140093
20110905D3140081
20110905D4150011
20110905D4150083
20110905D4150088 |
|
|