Page 1 of 1

How to print records count matched and unmatched in Sortjoin

PostPosted: Thu Apr 09, 2015 4:10 pm
by sachu1912
Hi,

I have a requirement to print the following details in the existing job.


File1 records read count
File2 records read count
Matched records read count
Unmatched record count only in file1
Unmatched record count only in file2
Number of records written in o/p file.
//File1  DD DSN=XXX
//File2  DD DSN=YYY
//SORTOUT  DD DSN=ZZZ
 JOINKEYS F1=File1,FIELDS=(1,9,A),SORTED,NOSEQCK 
 JOINKEYS F2=File2,FIELDS=(1,9,A),SORTED,NOSEQCK
 JOIN UNPAIRED,F1
 REFORMAT FIELDS=(F1:1,84,F2:14,2,F2:20,2,?)
 OUTREC IFTHEN=(WHEN=(89,1,CH,EQ,C'1'),
                   OVERLAY=(85:X'000C',87:X'000C'))


Please let me know how to do this.

I could see JNF1JMSG and JNF2JMSG does not have matched and unmatched records count and also I need to have these details in file.

Code'd and de-pickled

Re: How to print records count matched and unmatched in Sort

PostPosted: Thu Apr 09, 2015 4:56 pm
by NicC
When you join a forum please take time to study it carefully before posting. Your question is a sort question, not a JCL question. Moved.

Re: How to print records count matched and unmatched in Sort

PostPosted: Thu Apr 09, 2015 6:43 pm
by Terry Heinze
Also, in the future, please use Code tags to preserve accurate character spacing.

Re: How to print records count matched and unmatched in Sort

PostPosted: Thu Apr 09, 2015 9:42 pm
by BillyBoyo
If you want to count matches and non-matches, you need to know if there can be duplicates on one or other or both of the files. Because you need to know that, DFSORT doesn't automatically give you want you want (because what it gave you may not be what you want). Have a look here, http://ibmmainframes.com/about58035.html reading through to the answer by Skolusu.

Re: How to print records count matched and unmatched in Sort

PostPosted: Thu Apr 09, 2015 9:57 pm
by sachu1912
Yes the thing is whatever I mentioned is an existing job we don't to disturb the existing process and we want to add as a patch to existing job. I have tried with option given by kolusu but I was not able to get it.

Re: How to print records count matched and unmatched in Sort

PostPosted: Thu Apr 09, 2015 10:20 pm
by BillyBoyo
Can you show what you tried?

Re: How to print records count matched and unmatched in Sort

PostPosted: Fri Apr 10, 2015 1:17 pm
by sachu1912
I have tried the below Sort and it had abended with U0016

JOINKEYS F1=XX,FIELDS=(1,9,A),SORTED,NOSEQCK       
JOINKEYS F2=YY,FIELDS=(1,9,A),SORTED,NOSEQCK     
JOIN UNPAIRED,F1
  REFORMAT FIELDS=(F1:1,84,                                 
                                       F2:14,2,                                 
                                        F2:20,2, 
                                         ?)
  SORT FIELDS=COPY   
   OUTREC IFTHEN=(WHEN=(89,1,CH,EQ,C'1'),                     
                                                   OVERLAY=(85:X'000C',87:X'000C'),             
   OUTFIL FILES=OUT,TRAILER1=(1:COUNT),REMOVECC,NODETAIL))


Error Details:

             OUTREC IFTHEN=(WHEN=(89,1,CH,EQ,C'1'),                   
             OUTFIL FILES=01,TRAILER1=(1:COUNT),REMOVECC,NODETAIL))   
             $                                                         
 ICE006A 0 OPERAND DEFINER ERROR                                       
 ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K67572 E7-K70685           
 ICE052I 3 END OF DFSORT


Code'd

Re: How to print records count matched and unmatched in Sort

PostPosted: Fri Apr 10, 2015 2:03 pm
by BillyBoyo
You have a comma at the end of a line, so your OUTFIL is being treated as a continuation. You are also missing a right-parenthesis.

Re: How to print records count matched and unmatched in Sort

PostPosted: Fri Apr 10, 2015 2:09 pm
by sachu1912
I have this continuation since I want to count the number of matched records also along with overlay when it satisfies the below condition

OUTREC IFTHEN=(WHEN=(89,1,CH,EQ,C'1')

Re: How to print records count matched and unmatched in Sort

PostPosted: Fri Apr 10, 2015 3:24 pm
by BillyBoyo
OK, but it doesn't work like that. OUTFIL is entirely separate from OUTREC, or INREC, and that's the end of that story.

So, if you want an OUTFIL to contain only certain records, you use INCLUDE= or OMIT= to specify a condition.

   OUTFIL FILES=OUT,
          INCLUDE=(89,1,CH,EQ,C'1'),
          TRAILER1=(1:COUNT),
          REMOVECC,
          NODETAIL