Matched records alone need in o/p from both file !



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Matched records alone need in o/p from both file !

Postby ranga_subham » Sun Dec 21, 2008 2:51 pm

Hi,

I have two files and want the matched records only in the output from both the files :!: A temporary identification can be applied to both the files to determine the origin from where there come in the output.

INPUT-1:
----+----1----+----2----+----3----
VX2                GGGVX2     2460
BC2                MMMBC2     2160
GF2                KKKGF2     2460


INPUT-2:
----+----1----+----2----+----3----
VX2                GGGVX2     2442
VX2                GGGVX2     2442
GF2                KKKGFM     2442
GF2                KKKGFM     2442
GF2                KKKGFM     2442
GF2                KKKGFM     2442
J42                KRTJ42     2442
JK2                KRTJK2     2442


OUTPUT WITH MATCHED RECORDS:
----+----1----+----2----+----3----+----4
VX2                GGGVX2     2460     1
VX2                GGGVX2     2442     2
VX2                GGGVX2     2442     2
GF2                KKKGF2     2460     1
GF2                KKKGFM     2442     2
GF2                KKKGFM     2442     2
GF2                KKKGFM     2442     2
GF2                KKKGFM     2442     2


Note: Both the files may contain duplicates and are NOT in sorted order.

Please suggest.

Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Matched records alone need in o/p from both file !

Postby Alissa Margulies » Mon Dec 22, 2008 9:18 pm

Is the temporary file identification a requirement? Also, what fields are you matching (1-3,20-25,1-25)?
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Matched records alone need in o/p from both file !

Postby ranga_subham » Tue Dec 23, 2008 11:42 am

The field to be compared starts from 16th column (10 bytes). Applying an id is not part of requirement but to know from which file the records have come because matching records are to be pulled out from both the files including duplicates.
Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Matched records alone need in o/p from both file !

Postby Alissa Margulies » Fri Jan 02, 2009 11:23 pm

If your records can be pre-processed with a sequence number in addition to the file id, then here is a sample application you can use:

//STEP1  EXEC PGM=SORT               
//SORTOUT  DD DISP=(NEW,PASS),DSN=TEMP.DATASET,...
//SORTJNF1 DD *                             
VX2                GGGVX2     2460 1       1
BC2                MMMBC2     2160 1       2
GF2                KKKGF2     2460 1       3
//SORTJNF2 DD *                             
VX2                GGGVX2     2442 2       1
VX2                GGGVX2     2442 2       2
GF2                KKKGFM     2442 2       3
GF2                KKKGFM     2442 2       4
GF2                KKKGFM     2442 2       5
GF2                KKKGFM     2442 2       6
J42                KRTJ42     2442 2       7
JK2                KRTJK2     2442 2       8
//SYSOUT   DD SYSOUT=*   
//SYSIN    DD *                               
  JOINKEYS FILE=F1,FIELDS=(1,3,A)             
  JOINKEYS FILE=F2,FIELDS=(1,3,A)             
  REFORMAT FIELDS=(F1:1,44,F2:1,44)           
  SORT FIELDS=COPY                             
  OUTFIL OUTREC=(1:1,44,/,1:45,44)             
//*********************************************
//STEP2  EXEC PGM=SORT                         
//SORTIN   DD DISP=SHR,DSN=TEMP.DATASET
//SORTOUT  DD DSN=FINAL.OUTPUT,...
//SYSOUT   DD SYSOUT=*                         
//SYSIN    DD *                               
   SORT FIELDS=(20,6,CH,A,36,1,CH,A,37,8,CH,A)
   DUPKEYS FIELDS=NONE                             
   OUTREC BUILD=(1,36)
/*   

NOTE:
Support for DUPKEYS was included in SyncSort for z/OS 1.3. If you are running an earlier release, you can replace DUPKEYS with SUM.
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times

Re: Matched records alone need in o/p from both file !

Postby ranga_subham » Sat Jan 03, 2009 4:28 pm

Thank you. We are still at v1.2 only :(
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Matched records alone need in o/p from both file !

Postby Alissa Margulies » Mon Jan 05, 2009 9:23 am

Then as I previously mentioned, you can code SUM FIELDS instead of DUPKEYS FIELDS.
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 3 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post