Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Joinkeys operation when key1 and key2 is of different length

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Susanta

Active User


Joined: 17 Nov 2009
Posts: 118
Location: India

PostPosted: Wed Nov 02, 2016 5:35 pm    Post subject: Joinkeys operation when key1 and key2 is of different length
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Wed Nov 02, 2016 5:40 pm    Post subject: Reply to: Joinkeys operation when key1 and key2 is of different length
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: 118
Location: India

PostPosted: Wed Nov 02, 2016 5:46 pm    Post subject:
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: 2164
Location: @my desk

PostPosted: Wed Nov 02, 2016 6:34 pm    Post subject:
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: 1715
Location: UK

PostPosted: Wed Nov 02, 2016 8:24 pm    Post subject:
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: 331
Location: USA

PostPosted: Wed Nov 02, 2016 8:45 pm    Post subject: Reply to: Joinkeys operation when key1 and key2 is of different length
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Joinkeys operation betwen VB and FB file Susanta SYNCSORT 4 Sun Sep 25, 2016 9:49 pm
No new posts Joinkeys with duplicated keys juares castro SYNCSORT 19 Fri Sep 23, 2016 5:58 am
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Icetool or Joinkeys example to compar... ishant chauhan DFSORT/ICETOOL 21 Sat Aug 20, 2016 2:40 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us