Write the matched and unmatched record into files



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

Write the matched and unmatched record into files

Postby jvinoth » Thu Aug 02, 2012 1:01 pm

Hi,
I have two Input files.

Input file:1
------------
Record length:65,FB

Input file:2
-------------
Record length:469,FB

I need to compare the first file field(1,15) with the second file field(1,15).
if it matches then need to write the matched record of the Inputfile1 to the matched outputfile.
if it not matches with the second file then write the unmatched record of the inputfile1 to the unmathced outputfile.

please tell me how to do this using sort(joinkeys).
Input file:1
-------------
111111111111111
333333333333333
555555555555555
777777777777777
888888888888888

Input file:2
-------------
2222222222222  aaaa  gggg
1111111111111  trrd  hdgf
8888888888888  hrrr  reds
9999999999999  jgtf  fdes
5555555555555  iuyt  wesd

Mathced outputfile
------------------
1111111111111
5555555555555
8888888888888

Unmatched outputfile
--------------------
3333333333333
7777777777777

Thank you so much
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Write the matched and unmatched record into files

Postby jvinoth » Thu Aug 02, 2012 5:21 pm

I have used the below syntax and i'm getting both the paired and unpaired records of the inputfile1.
SORT FIELDS=COPY                   
JOINKEYS FILES=F1,FIELDS=(1,15,A)   
JOINKEYS FILES=F2,FIELDS=(1,15,A)   
JOIN UNPAIRED,F1                   
REFORMAT FIELDS=(F1:1,65)           

please tell me how to write seperately as paired record in onefile and unpaired record into aother file.


Thank you so much.
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Write the matched and unmatched record into files

Postby dick scherrer » Thu Aug 02, 2012 7:33 pm

Hello,

You now have 2 topics on this question. Will there be more? Which should we delete?

For starters, remove the SORT FIELDS=COPY

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Write the matched and unmatched record into files

Postby jvinoth » Thu Aug 02, 2012 8:57 pm

how can i get the matched record then.
remove another post sorry for same post in another form.
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Write the matched and unmatched record into files

Postby skolusu » Thu Aug 02, 2012 9:52 pm

jvinoth wrote:how can i get the matched record then. remove another post sorry for same post in another form


From your earlier posts , it is aware that you are running syncsort and I am not sure as to why you keep posting syncsort questions in DFSORT forum. You cannot use DFSORT control cards for syncsort. Please post your questions in syncsort forum.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Write the matched and unmatched record into files

Postby dick scherrer » Thu Aug 02, 2012 11:28 pm

Hello,

My bad - i should have remembered that jvinoth uses Syncsort . . . . I'll try to do better ;)

how can i get the matched record then.
Why would issuing a COPY first have anything to do with joining 2 files by their "key"?

Suggest you look in this part of the forum for other JOIN examples. Or review the material kin the Syncsort documentation.

Did you try moving the COPY or did you just assume that would not work/help?

Edited for correctness/clarification
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Write the matched and unmatched record into files

Postby Alissa Margulies » Fri Aug 03, 2012 12:25 am

The sort control statement is required. Try the following Syncsort step:
//STEP1  EXEC PGM=SORT                     
//SORTJNF1 DD *                           
1111111111111                             
3333333333333                             
5555555555555                             
7777777777777                             
8888888888888                             
//SORTJNF2 DD *                           
2222222222222  AAAA  GGGG                 
1111111111111  TRRD  HDGF                 
8888888888888  HRRR  REDS                 
9999999999999  JGTF  FDES                 
5555555555555  IUYT  WESD                 
//SORTOF01 DD DSN=MATCHED.RECORDS,DISP=...
//SORTOF02 DD DSN=UNMATCHD.RECORDS,DISP=...
//SYSOUT   DD SYSOUT=*                     
//SYSIN    DD *                             
  JOINKEYS FILE=F1,FIELDS=(1,15,A)       
  JOINKEYS FILE=F2,FIELDS=(1,15,A)       
  JOIN UNPAIRED,F1                       
  REFORMAT FIELDS=(F1:1,65,F2:1,1)       
  SORT FIELDS=COPY                       
  OUTFIL FILES=01,INCLUDE=(66,1,CH,NE,X'40'),BUILD=(1,65)
  OUTFIL FILES=02,INCLUDE=(66,1,CH,EQ,X'40'),BUILD=(1,65)
/*

I believe this should produce the desired output.
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: Write the matched and unmatched record into files

Postby jvinoth » Fri Aug 03, 2012 11:35 am

Thank you so mcuh alissa..
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Write the matched and unmatched record into files

Postby jvinoth » Fri Aug 03, 2012 12:20 pm

Please clarify mu doubt alissa.. why we are moving F2:1,1 in reformat field...
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Write the matched and unmatched record into files

Postby BillyBoyo » Fri Aug 03, 2012 12:46 pm

You need something from the F2 record to tell you whether it is "there" or not.

If there is an unmatched F1, the F2 will be set to a "fill" value of all spaces.

If there is a match the F2 will contain data. If your F2,1,1 might genuinely contain space, you can set the FILL to a different value (like X'FF') which the field cannot contain.

These users thanked the author BillyBoyo for the post:
Alissa Margulies (Sat Aug 04, 2012 12:20 am)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post