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
 

 

Syncsort Joinkeys - Join Unpaired

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
Mikel Terracina

New User


Joined: 02 Apr 2012
Posts: 11
Location: USA

PostPosted: Wed Oct 24, 2012 9:53 pm    Post subject: Syncsort Joinkeys - Join Unpaired
Reply with quote

Hello, any ideas on how to get the desired output (results on one line rather than two)?

InFile_1
Code:
11111 1000
22222 1001
22222 1002


InFile_2
Code:
11111 1000
22222 1001
33333 1002


Current Output
Code:
     22222    1002
33333     1002   


Desired Output
Code:
333332222210021002


JCL
Code:
//SYSIN DD *                                   
 JOINKEYS FILE=F1,FIELDS=(1,5,A,7,4,A)         
 JOINKEYS FILE=F2,FIELDS=(1,5,A,7,4,A)         
 JOIN UNPAIRED,ONLY                           
 REFORMAT FIELDS=(F2:1,5,F1:1,5,F2:7,4,F1:7,4)
 SORT FIELDS=COPY                             
/*


Thanks in advance for any help.

Mike

File samples Code'd
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Oct 24, 2012 10:01 pm    Post subject:
Reply with quote

Hello,

It will help someone help you if you post a more complete set of some input data and the expected output.

Explain the rules for getting from the input to the output.

Why are values from 2 unrelated keys combined on the same output line?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Oct 24, 2012 10:05 pm    Post subject: Reply to: Syncsort Joinkeys - Join Unpaired
Reply with quote

On what basis should they be on the same output record?

If, for this purpose, the 7,4 is a higher-order key, you have to make it so, but then it must be "unique" across your records.

If that does not do what you want, you are going to have to use GROUP in some way.

You have to explain them appearing on the same record and how you two key fields relate to each other, the existence of duplicates for either, and anything else you feel might be useful.
Back to top
View user's profile Send private message
Mikel Terracina

New User


Joined: 02 Apr 2012
Posts: 11
Location: USA

PostPosted: Wed Oct 24, 2012 11:51 pm    Post subject:
Reply with quote

My apologies. I now realize the description was pretty vague.

In a nutshell, here's my situation. I have two generational dataset's - a current generation (0) and a previous generation (-1). There are 2 keys within the files:

File layout
Code:
key-1 key-2
11111 1000
22222 1001


Sometimes between the previous generation and current generation key-2 may become associated with a different key-1:
Code:
previous generation (-1) file-1
11111 1000
22222 1001
22222 1002
44444 1004
44444 1005
77777 1007
77777 1008


current generation (0) - file-2
11111 1000
22222 1001
33333 1002  (key-2 associated with new key-1)
44444 1004
55555 1005  (key-2 associated with new key-1)
77777 1007
88888 1008  (key-2 associated with new key-1)


I would like to capture records where key-2 has been associated to a different key-1, but ideally have the output written on one line as such:
(current key-1) (previous key-1) (current key-2) (optional - prev key-2)
Code:
33333 22222 1002
55555 44444 1005
88888 77777 1008


However, my current output looks like this:
Code:
     22222    1002
33333     1002     
     44444    1005
55555     1005     
     77777    1008
88888     1008   


Thanks,
Mike
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Oct 25, 2012 12:25 am    Post subject: Reply to: Syncsort Joinkeys - Join Unpaired
Reply with quote

So join on your 2nd key only.

Get the matches (you'll have to decided if you can get mismatches, and what you'd want to do with them if you can). OMIT the reformat records where the first key is equal and what you should be left with is perhaps what you want?
Back to top
View user's profile Send private message
Mikel Terracina

New User


Joined: 02 Apr 2012
Posts: 11
Location: USA

PostPosted: Thu Oct 25, 2012 2:14 am    Post subject: Reply to: Syncsort Joinkeys - Join Unpaired
Reply with quote

Thanks Bill! That did the trick. Here's my JCL:

Code:
//SYSIN DD *                           
  JOINKEYS FILE=F1,FIELDS=(7,4,A)       
  JOINKEYS FILE=F2,FIELDS=(7,4,A)       
  REFORMAT FIELDS=(F2:1,5,F1:1,5,F2:7,4)
  SORT FIELDS=COPY                     
  OMIT COND=(1,5,CH,EQ,5,5,CH)         
/*
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Oct 25, 2012 2:17 am    Post subject: Reply to: Syncsort Joinkeys - Join Unpaired
Reply with quote

No problem. Thanks for letting us know, and posting your solution. It may help someone else in the future.
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts How can we have the varying lenth of ... Gunapala CN DFSORT/ICETOOL 6 Fri Oct 14, 2016 7:31 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am


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