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

Syncsort Joinkey


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nartcr

New User


Joined: 06 Jun 2007
Posts: 83
Location: anada

PostPosted: Thu Jun 02, 2016 3:46 am
Reply with quote

I am trying to code something with Syncsort.

Code:
FILE1                  FILE 2
COLUMNS                COLUMNS
12345678901234567890   12345678901234567890
--------------------   --------------------
R1TEST1  NARA          TEST1 REC1 NARA   HOME
R2TEST1  NARA          TEST2 REC1 NARA   LIBRA
R2AMER1  NARA          TEST2 REC1 AMAR   GROUN
R2AMER2  RAJE          AMER1 REC1 NARA   MOVIE
R2TEST1  AMAR

FILE 3
COLUMNS
12345678901234567890
--------------------
R1TEST1  NARA  HOME
R2TEST1  NARA  HOME
R2AMER1  NARA  MOVIE
R2AMER2  RAJE  NMTCH
R2TEST1  AMAR  NMTCH


I have 2 input files of same length - 20 bytes. Field1 ( File 1, position 3 onwards for 5 bytes ) have to be compared with Field1 ( file 2, position 1 onwards for 5 bytes ). If they match, i want the field2 ( file 1, position 10 onwards for 4 bytes ) have to be matched with field 2 ( file 2, position 12 onwards for 4 bytes ). If i have a perfect match, i willl update the output file with last 5 bytes of output file, with contents of file 2.

output will have 1-15 contents copied from file 1. 16-20 contents from file 2. If there is match on field1 and field2, 16-20 should contain contents from file 2, otherwise it should contains the letters 'NMTCH'.

I have been reading the manuals, and i am kind of confused with sort keys. Especially since key is not unique here. i tried coding with sequence number. Is this even possible to code wih syncsort or icetool? Or should i code using programs instead?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Jun 02, 2016 10:30 am
Reply with quote

why to make it difficult? you have to add these two fields (what you explained above) in the JOINKEYS then reformat fields as per what you want once you have that then make a use of parameter marker (?) to set NMATCH by using IFTHEN WHEN in the OUTREC
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: Thu Jun 02, 2016 11:17 am
Reply with quote

The keys are the things you are going to match on. Multiple key elements give you one logical key. If your logical keys can be duplicate, on one file or both, then you need some code in SORT to deal with that. There's a question form last week or so, perhaps in the DFSORT part of the forum, which goes into this. It is not difficult.
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts ICETOOL with JOINKEY for Big record l... DFSORT/ICETOOL 12
No new posts DFSORT/SYNCSORT/ICETOOL JCL & VSAM 8
No new posts Syncsort "Y2C" Function SYNCSORT 1
Search our Forums:

Back to Top