Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Join records from 2 files with No Duplicates using DFSORT
Goto page Previous  1, 2
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 212
Location: Maryland

PostPosted: Wed Sep 06, 2017 8:58 pm    Post subject:
Reply with quote

With your requirements, the options SORTED,NOSEQCK will not work as you wish.
Back to top
View user's profile Send private message

sergeyken

Active User


Joined: 29 Apr 2008
Posts: 212
Location: Maryland

PostPosted: Wed Sep 06, 2017 10:06 pm    Post subject:
Reply with quote

If you don't care about the final order of records, and/or alignment of your fields/commas, then this approach must work
Code:
//SORTJOIN EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//MASTER   DD  *                                               
*---+----1----+----2----+----3----+----4----+----5----+----6   
0000L01455    ,XXX,YYY,ABCDEF,                                 
4814375       ,XXX,YYY,GHIJKLMNO,                             
4814375       ,   ,   ,PQRSTUV,                               
0000L01762    ,XXX,YYY,WXYZAB,                                 
0000L02594    ,XXX,YYY,CDEFGHIJKL,                             
4828156       ,XXX,YYY,MNOPQRST,                               
4828156       ,   ,   ,UVWXY,                                 
0000L02908    ,XXX,YYY,ZABCDEFGH,                             
2307914558    ,XXX,YYY,IOSIF W,                               
2307914558    ,XXX,YYY,IOSIF W,                               
//DETAILS  DD  *                                               
*---+----1----+----2----+----3----+----4----+----5----+----6   
0000L01455    ,2013,-2200.22,                                 
4814375       ,2013,-5122,                                     
0000L01762    ,2013,-100,                                     
0000L02594    ,2013,-1056,                                     
4828156       ,2013,-3369,         
0000L02908    ,2013,-2440,         
2307914558    ,2013,-62,           
2307914558    ,2013,-93,           
//SORTOUT  DD SYSOUT=*             
//JNF1CNTL DD *                   
 OMIT COND=(1,1,CH,EQ,C'*')       
 INREC IFTHEN=(WHEN=GROUP,         
               KEYBEGIN=(1,15),   
               PUSH=(81:SEQ=4))   
//JNF2CNTL DD *                   
 OMIT COND=(1,1,CH,EQ,C'*')       
 INREC IFTHEN=(WHEN=GROUP,         
               KEYBEGIN=(1,15),   
               PUSH=(81:SEQ=4))   
//SYSIN    DD *                   
 JOINKEYS F1=MASTER,               
          FIELDS=(01,15,A,         
                  81,4,A)         
 JOINKEYS F2=DETAILS,             
          FIELDS=(01,15,A,                       
                  81,4,A)                       
 JOIN UNPAIRED,F1                               
 REFORMAT FIELDS=(F1:1,14,                       
                  F1:15,30,                     
                  F2:15,30),                     
         FILL=C' '                               
 SORT FIELDS=COPY                               
 OUTREC BUILD=(1,74,SQZ=(SHIFT=LEFT,MID=C' '))   
 END                                             
//*                                             

The result is like this
Code:
----+----1----+----2----+----3----+----4----+----5----+----6
0000L01455 ,XXX,YYY,ABCDEF, ,2013,-2200.22,                 
0000L01762 ,XXX,YYY,WXYZAB, ,2013,-100,                     
0000L02594 ,XXX,YYY,CDEFGHIJKL, ,2013,-1056,               
0000L02908 ,XXX,YYY,ZABCDEFGH, ,2013,-2440,                 
2307914558 ,XXX,YYY,IOSIF W, ,2013,-62,                     
2307914558 ,XXX,YYY,IOSIF W, ,2013,-93,                     
4814375 ,XXX,YYY,GHIJKLMNO, ,2013,-5122,                   
4814375 , , ,PQRSTUV,                                       
4828156 ,XXX,YYY,MNOPQRST, ,2013,-3369,                     
4828156 , , ,UVWXY,                                         
******************************** Bottom of Data ************

You can customize it as per additional rerquirements.
Back to top
View user's profile Send private message
Poha Eater

New User


Joined: 31 Aug 2016
Posts: 17
Location: India

PostPosted: Wed Oct 04, 2017 11:43 pm    Post subject:
Reply with quote

Hi Sergeyken,

Thanks a lot for your generous efforts in resolving my query. The below line in my output, it was just for representation purpose to show what values are coming at which column.

Code:

*---+----1----+----2----+----3----+----4----+----5----+----6


The control card which Magesh provided is working fine for my requirement. The only issue i am facing is that both the files are in unsorted order so when i am using the below code, it is only working till it is finding the key in sorted order. When it encounters the record whose key is not according to the sort, it is not joining the records.

I wanted to ask how can i modify the below sort card so that it can join the records when both the files are in unsorted order.

Code:
JOINKEYS FILES=F1,FIELDS=(01,15,A,174,4,A),SORTED,NOSEQCK   
JOINKEYS FILES=F2,FIELDS=(01,15,A,068,4,A),SORTED,NOSEQCK

//JNF1CNTL DD *                                                     
  INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,15),PUSH=(174:SEQ=4))         
//JNF2CNTL DD *                                                     
  INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,15),PUSH=(068:SEQ=4))


Please note that due to the nature of my requirement i can not write the output in sorted order.

Many Thanks !!
icon_smile.gif
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
Goto page Previous  1, 2
Page 2 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts Matching and unmatched records!! Vignesh Sid SYNCSORT 3 Thu Nov 09, 2017 11:22 am
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us