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

Files Matching using DFSORT


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

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Thu Mar 25, 2010 11:53 pm
Reply with quote

I have two files and want to extract only records according to below conditions

File 1 layout
Acct# pic x(16)
.....
....
Date pic 9(5) comp-3

file2 layout

Acc# pic x(16)
....
....
Date pic 9(5) comp-3

Now i want only records where acct# in file 1 is equal to Acct# in file 2 and date in file1 is greater than date in file 2.

I know only matching full data instead of comparison... i used below code.....

Code:

//SYSIN DD *
  JOINKEYS FILE=F1,FIELDS=(1,16,A,23,3,A)
  JOINKEYS FILE=F2,FIELDS=(1,16,A,20,3,A)
  REFORMAT FIELDS=(F1:180)
  SORT FIELDS=COPY
/*


in the above code 23rd position in file 1 is date and 20th position is file2 is date that needs to compared..... the above code provide only matching records... but i need 23rd position data in file 1 is greater than 20th position in file 2...
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Mar 26, 2010 1:22 am
Reply with quote

use the following DFSORT control cards

Code:

//SYSIN    DD *                                       
  SORT FIELDS=COPY                                     
  JOINKEYS FILES=F1,FIELDS=(1,16,A)                   
  JOINKEYS FILES=F2,FIELDS=(1,16,A)                   
  REFORMAT FIELDS=(F1:1,180,F2:20,3)                   
  OUTFIL INCLUDE=(23,3,PD,GE,181,3,PD),BUILD=(1,180)   
//*
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Sat Mar 27, 2010 9:28 pm
Reply with quote

Thanks Skolusu... it worked out for me...

i have one issue here... the problem is with the date.... in both te files the is in YYDDD (julian format).... i.e if its jan 5th 2010 means... the date field will have 10005 in PD format.... here i have problem with Y2K.... our system is from 1985.... if the record is file 2 is created on jan 5th 1990 then this date field will have 90005... actually speaking 10005 is greater than 90005 as per my records.... but due to numeric comparison it is consdering 90005 is greater and i am not getting correct results.. we use date routines in cobol program to convers the date to CCYYMMDD format for comparison.. but in SORT we never did it...

pls tell me whether this is possible in SORT, if not possible i will jump to COBOL program.... since i almost done with my requirement, only porblem is with DATE....
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat Mar 27, 2010 11:29 pm
Reply with quote

Take a look at Y2PAST and other references to century window in the sort manual....
Back to top
View user's profile Send private message
sasikumar1984

Active User


Joined: 02 Jul 2007
Posts: 109
Location: Chennai - India

PostPosted: Sun Mar 28, 2010 9:33 am
Reply with quote

Thanks CICS guy...

I just gone thru the links u provided to me.... and i have modified my SORT CARD and please find the same in below...

Code:
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                     
  JOINKEYS FILES=F1,FIELDS=(1,16,A)                   
  JOINKEYS FILES=F2,FIELDS=(1,16,A) 
  OPTION Y2PAST=1985               
  REFORMAT FIELDS=(F1:1,180,F1:23,3)                   
  OUTFIL INCLUDE=(23,1,Y2D,A,24,2,PD,A,GE,181,1,Y2D,A,182,2,PD,A),BUILD=(1,180)
//*


Since my system started in 1985, i set Y2PAST a 1985. and started comparing the fields.... i cannt test this until monday... but i would like to know comments on this.... because if it dont work again i have to come and post on tuesday which will delay of my work.... pls correct me if its wrong...
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Mar 29, 2010 10:15 pm
Reply with quote

sasikumar wrote:
but i would like to know comments on this.... because if it dont work again i have to come and post on tuesday which will delay of my work.... pls correct me if its wrong...



Sasikumar,

It would have saved you a lot of time if you had initially posted the date format you had. The syntax you have shown is wrong. The format you have is Y2U.(a 3 byte packed decimal P'yyxxx' (X'yyxxxs') format

Use the following control cards

Code:

//SYSIN    DD *                                       
  OPTION COPY,Y2PAST=1985                             
  JOINKEYS FILES=F1,FIELDS=(1,16,A)                   
  JOINKEYS FILES=F2,FIELDS=(1,16,A)                   
  REFORMAT FIELDS=(F1:1,180,F2:20,3)                   
  OUTFIL INCLUDE=(23,3,Y2U,GE,181,3,Y2U),BUILD=(1,180)
//*
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top