Match 2 Fields To Extract A 3rd Field



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

Match 2 Fields To Extract A 3rd Field

Postby chuckb » Fri May 06, 2011 12:16 am

I'm fairly new to Synctool. I am attempting to compare a field in one record to a field in another record and when they match, pull a third field from one of the records. Sample data:

Record 1: Field_A Field_B Field_C
Record 2: Field_X Field_A

When Field_A matches, pull Field_C and output to new file: FIeld_X Field_A Field_C

Your assistance is appreciated.
chuckb
 
Posts: 2
Joined: Thu May 05, 2011 10:22 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Match 2 Fields To Extract A 3rd Field

Postby Alissa Margulies » Fri May 06, 2011 12:23 am

Here is a sample SyncSort for z/OS job that will produce the requested output:
//SORT1  EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*             
//SORTOUT  DD SYSOUT=*             
//SORTJNF1 DD *                     
FIELD_A FIELD_B FIELD_C             
//SORTJNF2 DD *                     
FIELD_X FIELD_A                     
//SYSIN DD *                       
  JOINKEYS FILES=F1,FIELDS=(1,7,A)
  JOINKEYS FILES=F2,FIELDS=(9,7,A)
  REFORMAT FIELDS=(F2:1,16,F1:17,7)
  SORT FIELDS=COPY                 
/*     
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: Match 2 Fields To Extract A 3rd Field

Postby chuckb » Fri May 06, 2011 2:22 am

Thanks!
chuckb
 
Posts: 2
Joined: Thu May 05, 2011 10:22 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post