Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
Hi All,
I have two files of the following format
File 1 : Currency (3 bytes ), Key1(10 bytes) and date range (180 bytes) date is in format YYMMDD
File 2 : Key(10 bytes) , Date Range(180 bytes) date in format YYMMDD
the date range is basically a set of 30 dates each of 6 bytes (total 180)
My requirement is to check for a particular currency/key whether in those 180 bytes, current date and next 7 days are present in file 1, if any of these 7 days are present then check in file two if the same date is present in the 180 bytes of file2. If yes then report it as a match else report it as non matching.
first need to check whether current date is present in file 1 in those 180 bytes, if yes then check in file 2 for the same date in 180 bytes.
If present in both files report it as present else no match.
I tried using Sub string facility in dfsort to find the current date but how do i give the date as a YYMMDD format and that too in SS ?
Is there any other way to accomplish this ?
DATE1 basically give date in YYYYMMDD format, what is the date function for YYMMDD , also how to join the two files for the above check ?
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Suggest you post more sample input (using the "Code" tag) and the output you want when the sample input is processed (also using the Coge tag) explaining the rules that caused the output to be what you show.
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
Sure Dick.
My file 1 contains data in the format
Code:
GBP0000000001120618120619120620....
where GBP (3 bytes) is currency, followed by 0000000001 which is currency code (10 bytes) and then 30 dates in YYMMDD (180 bytes total).
File contains
Code:
0000000001120503120618120619120621......
where 0000000001 is currency code which is same as in file1 and then 30dates in YYMMDD (total 180 bytes). The 180 bytes of two files need not be the same.
Now i need to check whether current date 120618 is present in file1, if yes then check in file2 for the occurence of the same date for the same currency.
If present in both report as a match else no match.
In file1 120618 is from 11-17 while in file2 its in a different position. The position is not fixed in none of the records.
I tried sorting the records for all currencies for which either the current date or the date in the next 7 days are present
using
Code:
(14,6,Y2T,GE,Y'DATE1',AND,14,6,Y2T,LE,Y'DATE1'+7)
similary for all 30 dates for total 180 bytes, so basically i have an OR on the condition for
positions starting 14,20,26,32 etc. I am not sure whether there is a simple option to check for the presence of current date or current date+ 7 days in the
180 bytes, similar to SS function of string. Its not accepting Y'DATE1' as the search string - Invalid comparison.
I want the output to be GBP120618120619 as 18th and 19th is present in both files - first o/p
2 o/p should be GBP120620 as this is present in file1 but not in file2.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
ashimer,
Does the Date in any of the files re-occur in any of the 30 occurrences ? i.e 061812 is found in pos 14(slot1) , can it occur in pos 164(slot 26) ? or is the date is unique for each record?
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
ashimer,
The following DFSORT JCL will give you the desired results. Since you are interested in just 1 week worth of data, we will replace only those dates and perform the join.
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
Thanks Kolusu, I didnt get the o/p exactly as required but if you could explain be the step200 i can change it as per my needs. I frankly did not get the whole logic behind step200
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
ashimer wrote:
Thanks Kolusu, I didnt get the o/p exactly as required but if you could explain be the step200 i can change it as per my needs. I frankly did not get the whole logic behind step200
Well the logic is quite simple. All you are interested is in 8 dates (current date thru current date + 7) i.e
for today Jun 20 2012 you want validate these dates in your files
FR1 will replace all DESIRED dates (shown above ) to A,B,C,D,E,F,G,H respectively in both files i,e
Code:
120620 will become A
120621 will become B
120622 will become C
120623 will become D
120624 will become E
120625 will become F
120626 will become G
120627 will become H
And other 22 dates which we don't care will be suppressed. So now you are just left with
File 1 will have Currency (3 bytes ), Key1(10 bytes) and 8 alphabets(A-H) depending on the availability)
File 2 will have Key1(10 bytes) and 8 alphabets(A-H) depending on the availability)
Now we match on the key and create 1 single record for every matching record as follows
Code:
Match record = Currency (3 bytes ), Key1(10 bytes) and 8 alphabets from file1 (A-H) depending on the availability)
AND
8 alphabets from file2 (A-H) depending on the availability)
Now all you need to do is check if file1 dates are matching with file2 dates. (This part I left out hoping that you can manage) oh well looks like I have to layout everything.
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
Yes Kolusu, in fact i went ahead with your step100 and then joined two files to produce the dates present for the currency in a single line itself, that itself proved sufficient for my requirement.