IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Joinkeys operation when key1 and key2 is of different length


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Susanta

Active User


Joined: 17 Nov 2009
Posts: 126
Location: India

PostPosted: Wed Nov 02, 2016 5:35 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Nov 02, 2016 5:40 pm
Reply with quote

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
View user's profile Send private message
Susanta

Active User


Joined: 17 Nov 2009
Posts: 126
Location: India

PostPosted: Wed Nov 02, 2016 5:46 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Nov 02, 2016 6:34 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Nov 02, 2016 8:24 pm
Reply with quote

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
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Wed Nov 02, 2016 8:45 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts VB to VB copy - Full length reached SYNCSORT 8
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
Search our Forums:

Back to Top