IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

compare time columns using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Fri Sep 09, 2011 12:00 pm
Reply with quote

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
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Fri Sep 09, 2011 12:21 pm
Reply with quote

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
Back to top
View user's profile Send private message
useit

Active User


Joined: 05 Oct 2006
Posts: 152

PostPosted: Fri Sep 09, 2011 12:49 pm
Reply with quote

it is working and thanks a lot for your help:)

Regds,
useit
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top