Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Files Matching using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Files Matching using DFSORT
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    Post subject: Reply to: Files Matching..
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    Post subject: Reply to: Files Matching using DFSORT
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: 2150
Location: At my coffee table

PostPosted: Sat Mar 27, 2010 11:29 pm    Post subject:
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    Post subject: Reply to: Files Matching using DFSORT
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    Post subject: Reply to: Files Matching using DFSORT
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us