>>Could anyone let me know how this to be done using dfsort. Ron,
All of your previous queries showed that you are using the competitive product to DFSORT. If that is still true, I would really appreciate if you can stop tagging the questions as DFSORT questions. Giving you the benefit of doubt, I am going to list the procedure(not code the entire JCL for you) to get the desired results. Step:1 1. SORT the file on ALL the fields (ITEM NUMBER,UPC_NBR,VendorNbr,STATE_CODE,BUY_PRICE) 2. Using OUTREC WHEN=GROUP with KEYBEGIN on (ITEM NUMBER,UPC_NBR,VendorNbr,STATE_CODE), you would PUSH the Buy_price on to position 81. 3. Using another IFTHEN WHEN (64,10,CH,NE,81,10,CH) OVERLAY a value of 'P' at position 92 4. Using OUTFIL FNAMES you write 2 files. a. ORIG as is so that it will have all the records but in SORTED order. b. PULL will only have records which have P at position 92. Using sections(1,64) and Trailer3 you will write 1 record per key. Step 2: 1. Compare the files ORIG and PULL using JOINKEYS on (ITEM NUMBER,UPC_NBR,VendorNbr,STATE_CODE,BUY_PRICE) and write out the matching records 2. Since the files are already SORTED on the keys to compare, code SORTED,NOSEQCK on the JOINKEY statements, so that a COPY operation is used. This should give you the desired results that you are looking for. Thanks, Kolusu DFSORT Development IBM Corporation ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN