Thanks, Sri, it works exactly as needed. I will have to look up some of these commands to understand them better, but I get the gist of what is happening, and appreciate your help!
Have a good afternoon! Billy On Tue, Nov 18, 2014 at 1:13 PM, Sri h Kolusu <[email protected]> wrote: > Bill, > > It is quite simple. All you need is to change this statement in SYSIN from > > JOIN UNPAIRED > > to this statement (Just add F2 at the end) > > JOIN UNPAIRED,F2 > > Thanks, > Kolusu > DFSORT Development > IBM Corporation > > > > From: Bill Ashton <[email protected]> > To: [email protected] > Date: 11/18/2014 10:07 AM > Subject: Re: Sort to show differences in a 2-file match > Sent by: IBM Mainframe Discussion List <[email protected]> > > > > Thanks so much, Sri. This works fine to accomplish my first goal...In my > correction afterward, I realized I will always have more records in F1 > (INA) that will not be in F2 (INB). How can I drop the test for "Recs in > A, > not in B"), and only report those records in B that are not in A, and > those > in A & B that mismatch? > > Billy > > > On Tue, Nov 18, 2014 at 11:45 AM, Sri h Kolusu <[email protected]> wrote: > > > Bill, > > > > It is quite simple to get a mismatch file using JOINKEYS. There are a > > couple of DFSORT smart tricks which shows the usage of Joinkeys > > > > Join fields from two files on a key > > Join fields from two files record-by-record > > Cartesian join > > Create files with matching and non-matching records > > > > http://www-01.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094 > > > > In your case you wanted a little more about validating the data even on > a > > match. So use the following DFSORT JCL which will give you the desired > > results. I added a 23 byte text to denote how the mismatch occurred. > > > > RECORD FOUND ONLY IN F1 > > RECORD FOUND ONLY IN F2 > > KEY MATCH DATA MISMATCH > > > > You will find this text at the end of each record. ie. at position 2525. > > > > > > //STEP0100 EXEC PGM=SORT > > //SYSOUT DD SYSOUT=* > > //INA DD DISP=SHR,DSN=Your Input 2524 File A > > //INB DD DISP=SHR,DSN=Your Input 2524 File B > > //SORTOUT DD SYSOUT=* > > //SYSIN DD * > > JOINKEYS F1=INA,FIELDS=(1,24,A) > > JOINKEYS F2=INB,FIELDS=(1,24,A) > > JOIN UNPAIRED > > REFORMAT FIELDS=(F1:1,2524,F2:1,2524,?) > > OPTION COPY > > OMIT COND=(5049,001,CH,EQ,C'B',AND, > > 0025,256,CH,EQ,2549,256,CH,AND, > > 0281,256,CH,EQ,2805,256,CH,AND, > > 0537,256,CH,EQ,3061,256,CH,AND, > > 0793,256,CH,EQ,3317,256,CH,AND, > > 1049,256,CH,EQ,3573,256,CH,AND, > > 1305,256,CH,EQ,3829,256,CH,AND, > > 1561,256,CH,EQ,4085,256,CH,AND, > > 1817,256,CH,EQ,4341,256,CH,AND, > > 2073,256,CH,EQ,4597,256,CH,AND, > > 2329,196,CH,EQ,4853,196,CH) > > > > INREC IFOUTLEN=2547, > > IFTHEN=(WHEN=(5049,1,CH,EQ,C'1'), > > BUILD=(0001,2524,C'RECORD FOUND ONLY IN F1')), > > IFTHEN=(WHEN=(5049,1,CH,EQ,C'2'), > > BUILD=(2525,2524,C'RECORD FOUND ONLY IN F2')), > > IFTHEN=(WHEN=NONE, > > BUILD=(1,2524,C'KEY MATCH DATA MISMATCH')) > > > > //* > > //JNF1CNTL DD * > > OPTION DYNALLOC=(,8) > > //* > > //JNF2CNTL DD * > > OPTION DYNALLOC=(,8) > > //* > > > > Here is a detailed explanation of Joinkeys. > > > > http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA60/4.0? > > > > Further if you have any questions please let me know > > > > Thanks, > > Sri Hari Kolusu > > DFSORT Development > > IBM Corporation > > Email: [email protected] > > Phone: 408-927-2187 Tie Line: 457-2187 > > > > > > > > From: Bill Ashton <[email protected]> > > To: [email protected] > > Date: 11/18/2014 04:58 AM > > Subject: Sort to show differences in a 2-file match > > Sent by: IBM Mainframe Discussion List <[email protected]> > > > > > > > > Hi Sri et al., I have 2 files that I would like to compare, file "A" has > > 50000 records, and file "B" only a subset of that - maybe 1000 records. > > They have the same key (pos 1, len 24), but are not unloaded in key > order. > > The records are 2524 bytes long (24 byte key + 2500 bytes data). > > > > I know I can sort them in one step to fix that problem, but then I want > to > > produce a file "C" of only the mismatches: > > * Records in A, not in B > > * Records in B, not in A > > * Records in A with matching keys to B, but the data in A does not match > B > > > > I have done this before in CA Easytrieve, but this client does not have > > that. Is there a way to do this in a SORT step? > > > > -- > > Thank you and best regards, > > *Billy Ashton* > > > > ---------------------------------------------------------------------- > > For IBM-MAIN subscribe / signoff / archive access instructions, > > send email to [email protected] with the message: INFO IBM-MAIN > > > > > > > > ---------------------------------------------------------------------- > > For IBM-MAIN subscribe / signoff / archive access instructions, > > send email to [email protected] with the message: INFO IBM-MAIN > > > > > > -- > Thank you and best regards, > *Billy Ashton* > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > > > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > -- Thank you and best regards, *Billy Ashton* ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
