title: How to Get Matching records from both F1 & F2 in output file1 and Non-Matching Records from F2 in output File 2 using Sort
body: <p>Hi I am trying to Find Matching and Un Matching records from 2 file, one file is a Error file with 181 LRECL, second file F2 is valid records file with same 181 LRECL.</p>
  <p>Example ERROR File</p>
  <pre><code>12345678901
  11111111111
  11111111111
  22222222222
  </code></pre>
  <p>VALID File has</p>
  <pre><code>33333333333
  11111111111
  11111111111
  44444444444
  </code></pre>
  <p>I implemented the Left Outer join</p>
  <pre><code>//F1       -&gt; ERROR FILE
  //F2       -&gt; VALID FILE
  //SYSOUT   DD SYSOUT=*                                                       
  //SYSIN    DD *                                                       
    JOINKEYS F1=MAIN,FIELDS=(43,11,A)                            
    JOINKEYS F2=LOOKUP,FIELDS=(10,11,A)                               
    JOIN UNPAIRED,F2 ONLY                                                
    SORT FIEDLS=COPY
  /*   
  
             
  </code></pre>
  <p>so using this I was able to get the valid records that were not present in Error file in sysout</p>
  <p>SYSOUT:</p>
  <pre><code>33333333333
  44444444444
  </code></pre>
  <p>but I don't want lose the Match Records from both File and want to Write the Matching Records from Both file in Second Output file.</p>
  <p>I tried Implementing</p>
  <p>the FULL OUTER Join, but was unable to get the result</p>
  <pre><code>//F1 -&gt; Error File
  //F2 -&gt; Valid File
  //MATCH    DD DSN=MYDATA.URMI.SAMPLE.MATCH,DISP=OLD
  //NOMATCH1 DD DSN=MYDATA.URMI.SAMPLE.NOMATCH1,DISP=OLD
  //NOMATCH2 DD DSN=MYDATA.URMI.SAMPLE.NOMATCH2,DISP=OLD 
  //SYSOUT   DD SYSOUT=*                                                       
  //SYSIN    DD *                                                       
    JOINKEYS F1=MAIN,FIELDS=(43,11,A)                            
    JOINKEYS F2=LOOKUP,FIELDS=(10,11,A)                               
    JOIN UNPAIRED,F1,F2                                                 
    REFORMAT FIELDS=(?,F1:1,181,F2:1,181)                                
    OPTION COPY                                                         
    OUTFIL FNAMES=MATCH,INCLUDE=(1,1,CH,EQ,C'B'),BUILD=(1:2,181)                                                
    OUTFIL FNAMES=NOMATCH1,INCLUDE=(1,1,CH,EQ,C'1'),BUILD=(1:2,181) 
    OUTFIL FNAMES=NOMATCH2,INCLUDE=(1,1,CH,EQ,C'2'),BUILD=(1:2,181) 
  /*     
  
           
  </code></pre>