|
View previous topic :: View next topic
|
| Author |
Message |
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 109 Location: Chennai - India
|
|
|
|
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
 |
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 109 Location: Chennai - India
|
|
|
|
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 |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
| Back to top |
|
 |
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 109 Location: Chennai - India
|
|
|
|
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 |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|