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 - almost done, but slight problem.... Please assist

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

New User


Joined: 03 Jul 2006
Posts: 53

PostPosted: Fri May 24, 2013 8:54 pm    Post subject: JOINKEYS - almost done, but slight problem.... Please assist
Reply with quote

I need to join to update FILE1 with data from FILE2 joining using keys in pos 1-6. If match not found I want to keep FILE1 record intact.
If match found I need to move pos 13-20 from FILE2 to FILE1.
For some reason I'm overriding with blanks unmatched records.

This is my SORT:

Code:
//STEP1 EXEC PGM=SORT                             
//SORTJNF1 DD *                                   
----+----1----+----2----+----3----+----4----+----5
111111FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY         
222222FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY         
333333FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY         
444444FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY         
555555FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY         
666666FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY         
//SORTJNF2 DD *                                   
----+----1----+----2----+----3----+----4----+----5
222222SECONDAAAAAAAAAAAAAAAAAAAABBBBBBBB         
333333SECONDAAAAAAAAAAAAAAAAAAAABBBBBBBB         
555555SECONDAAAAAAAAAAAAAAAAAAAABBBBBBBB         
666666SECONDAAAAAAAAAAAAAAAAAAAABBBBBBBB         
//SORTOF01 DD SYSOUT=*                           
//SYSOUT DD SYSOUT=*                             
//SYSIN    DD    *                               
   JOINKEYS FILES=F1,FIELDS=(1,6,A)               
   JOINKEYS FILES=F2,FIELDS=(1,6,A)               
   JOIN UNPAIRED,F1                         
   REFORMAT FIELDS=(F1:1,40,F2:1,40)       
   SORT FIELDS=COPY                         
   OUTFIL FILES=01,INCLUDE=(1,1,CH,NE,C' '),
   OUTREC=(1,12,53,20,33,8)                 
/*                                         


I get this output - as you see I loose data in the middle...

Code:
----+----1----+----2----+----3----+----4
111111FIRSTF                    YYYYYYYY
222222FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
333333FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
444444FIRSTF                    YYYYYYYY
555555FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
666666FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY


And I need to get this:

Code:
----+----1----+----2----+----3----+----4
111111FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY
222222FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
333333FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
444444FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY
555555FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
666666FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY   
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri May 24, 2013 9:02 pm    Post subject:
Reply with quote

I believe you are using Syncsort. Can you clarify that?
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri May 24, 2013 9:08 pm    Post subject:
Reply with quote

What is the product are you using DFSORT or SYNCSORT?

And as per your requirement I would expect an output like this

Code:
111111FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY
222222FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
333333FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
444444FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY
555555FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
666666FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
Back to top
View user's profile Send private message
rmd3003

New User


Joined: 03 Jul 2006
Posts: 53

PostPosted: Fri May 24, 2013 9:16 pm    Post subject:
Reply with quote

Pandora-Box wrote:
What is the product are you using DFSORT or SYNCSORT?

And as per your requirement I would expect an output like this

Code:
111111FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY
222222FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
333333FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
444444FIRSTFXXXXXXXXXXXXXXXXXXXXYYYYYYYY
555555FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY
666666FIRSTFAAAAAAAAAAAAAAAAAAAAYYYYYYYY


Yes, this is the output I expect.
SYNCSORT
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri May 24, 2013 9:18 pm    Post subject:
Reply with quote

rmd3003,

You are already advised about posting syncsort questions in the JCL forum and yet you still post in DFSORT forum. Please post your questions in the JCL forum.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri May 24, 2013 9:23 pm    Post subject:
Reply with quote

Ok Please post SYNCSORT questions in JCL forum

And to hint almost done solution

When File 1 key is not present in File 2 ==> 53,20 would be blank
so you need to check for postion 41 and not 1

and Also you might need to add another condition when 41,1 is eq to space all you need is 1,40 from the reformatted data

Please try this using INREC IFTHEN & WHEN=<CONDITION>

If your version of product doesnt support you might need to have two outputfiles with OUTFIL INCLUDE logic
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 Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11: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 DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm


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