View previous topic :: View next topic
|
Author |
Message |
Susanta
Active User
Joined: 17 Nov 2009 Posts: 129 Location: India
|
|
|
|
hI
i have a requirement to match 2 files..
file 1: 16 bytes in lenght
file 2 : 28 bytes in length
file1: content having filed 1 of 16 bytes whee some values are of 14 byte with traling 2 byte spaces and soem are actual 16 bytes
12345678901234
12345678901230
1234567890123456
1234567890123450
file2: content having filed1 filed2 of 14 bytes
1234567890123412345678901211
1234567890123012345678901222
need to match file1 16 bytes without considering trailing spaces to 14 byte filed1 of file 2 and replace filed1 with filed2 if mathc found.
my query is can we have as below where diffreent lenght is used for F1 and F2.?
I assume Joinkeys for example will consider 'ABC ' as 'ABC' as same .
ignoring trailing spaces is that so?
Code: |
JOINKEYS FILE=F1,FIELDS=(1,16,CH,A)
JOINKEYS FILE=F2,FIELDS=(1,14,CH,A) |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
The keys must be the same length for JOINKEYS.
You need to show the output you expect for the data you have shown (and make sure you have shown "representative" data). It is not clear from your description what you are trying to do. |
|
Back to top |
|
|
Susanta
Active User
Joined: 17 Nov 2009 Posts: 129 Location: India
|
|
|
|
Hi..
please find as below..
file1: filed1<16>
Code: |
-------------------
22222222222222
11111111111111
33333333333333
4444444444444444
5555555555555555 |
file2: fileld1<14>field2<14>
Code: |
--------------------------------
1111111111111111111111111110
2222222222222222222222222220
|
required output file: field1<16>
Code: |
------------------------------------
22222222222220
11111111111110
33333333333333
4444444444444444
5555555555555555 |
The problem is the file2 fileds are of 14 byte in lenght otherwise could have a same lenght key match.. and also only 14 byte fileds of file1 needs to be replaced..
Code'd : Please use code tags while posting code/sample data |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Susanta,
If I understood correctly - Use 14 byte keys in your JOIN with a JOIN UNPAIRED,F1
Code: |
JOINKEYS FILE=F1,FIELDS=(1,14,CH,A)
JOINKEYS FILE=F2,FIELDS=(1,14,CH,A)
JOIN UNPAIRED,F1
REFORMAT=(F1:1,16,F2:1,14)
INREC IFTHEN.... |
and include the entire 16 byte key from file1 and the 14 byte key from file2 in the REFORMAT. Then in an INREC IFTHEN, check if file1 keys have 2 trailing blanks, if yes then OVERLAY with the 14-byte field from file2. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
Nothing to do with JCL or VSAM. After 9 years being a member of the forum you should know that sort questions go in the subsection of the forum particular to your sort product.
Moved. |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
What is the significance of 2 bytes of trailing spaces? Do you only want to match records which have these 2 bytes of spaces?
What if your file2 is like:
Code: |
--------------------------------
1111111111111111111111111110
2222222222222222222222222220
44444444444444xxxxxxxxxxxxx0 |
Do you want to match that '44444444444444' record or Not?
. |
|
Back to top |
|
|
|