1. File1 -is sent by Business Unit.
2. File2- is unloaded from DB2 Tables
I am copying Matching Records into third file by using Joinkeys. But facing problem while matching the dates.
Date Field in file1 comes with Leading Zero in the format 01/01/2012 -
X(10).
and from the file2 which is from DB2 table, It comes as 1/1/2012
Due to leading Zero from file1, the record is not getting matched. Is it possible to remove the leading zero in Joinkey while matching the record.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
This should give you a start. Check back later for a better solution from elsewhere.
The adjustment of the date is done in the JNF1CNTL file. I've just used DD * to test with dates alone, so you'll have to adjust the positions for your dates.
The OPTION COPY, JOIN UNPAIRED, REFORMAT and BUILD are just for testing the sample, you'll obviously have your own code for what you need.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Ideally I would prefer to perform the comparison on CCYY/MM/DD format instead of DD/MM/CCYY format, so that dates are sorted in ascending sequence. Use Parse to build the dates in CCYY/MM/DD format.
Ideally I would prefer to perform the comparison on CCYY/MM/DD format instead of DD/MM/CCYY format, so that dates are sorted in ascending sequence. Use Parse to build the dates in CCYY/MM/DD format.
You can use the below given sample code. Please note that rather than providing you with the logic to remove the leading zeroes from the input1, I am suggesting you to add leading zeroes to input2.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Nikhil Jain wrote:
You can use the below given sample code. Please note that rather than providing you with the logic to remove the leading zeroes from the input1, I am suggesting you to add leading zeroes to input2.
Did you test your control cards? I am not sure as to where you have a "|" delimiter in the sample input. Why are you editing the date to be just 8 bytes instead of 10 ?
Did you test your control cards? I am not sure as to where you have a "|" delimiter in the sample input. Why are you editing the date to be just 8 bytes instead of 10 ?
Apologies for the confusion Skolusu. I have only provided the sample code to give the user an idea.I believe with slight modification he should be able to customise it to suit his requirement. The objective was to instigate the TS to give it a thought.