Ok Elardus. I will paste the requirement and output files generated again
We have a FB File LRECL = 80 bytes and here below is the layout. Buy_price is at position 65 of length 10 bytes . We need to pull those item nbrs which has same UPC,Vendor nbr ,State Code but there is price difference. Could anyone let me know how this to be done using dfsort. Input file :- ITEM NUMBER UPC_NBR VendorNbr STATE_CODE BUY_PRICE 500000338 789997580026.00 36052910 DF 96.12 500000338 789997580026.00 36052910 DF 96.12 500000338 789997580026.00 36052910 DF 95.12 500000318 789997580026.00 36052910 DF 95.12 500000318 789997580026.00 36052911 DF 95.12 500000318 789997580026.00 36052911 DF 95.12 Desired o/p 500000338 789997580026.00 36052910 DF 96.12 500000338 789997580026.00 36052910 DF 96.12 500000338 789997580026.00 36052910 DF 95.12 Code created: - //STEP03 EXEC SORT //SORTIN DD * 500000338 789997580026.00 36052910 DF 96.12 500000338 789997580026.00 36052910 DF 96.12 500000338 789997580026.00 36052910 DF 95.12 500000318 789997580026.00 36052910 DF 95.12 500000318 789997580026.00 36052911 DF 95.12 500000318 789997580026.00 36052911 DF 95.12 //SORTOUT DD DSN=T01.RXVD.PULL, // SPACE=(CYL,(50,50),RLSE),VOL=(,,,99), // DISP=(NEW,CATLG,DELETE) //SYSIN DD * SORT FIELDS=(1,37,CH,A) OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,37),PUSH=(81:65,10)), IFTHEN=(WHEN=(64,10,CH,NE,81,10,CH),OVERLAY=(92:C'P')) OUTFIL FNAMES=SORTOUT,REMOVECC,NODETAIL, INCLUDE=(92,1,CH,EQ,C'P'), SECTIONS=(1,64,TRAILER3=(1,64,COUNT=(EDIT=(IIII))),65,10) /* output file Generated - 500000318 789997580026.00 36052910 DF 1 500000318 789997580026.00 36052911 DF 2 500000338 789997580026.00 36052910 DF 3 I am not sure whether this o/p is correct . Also for the Joinkeys . This below is what i have coded //STEP01 EXEC SORT //SYSOUT DD SYSOUT=* // DD SYSOUT=* //BOTH DD DD SYSOUT=* //SORTJNF1 DD * 500000338 789997580026.00 36052910 DF 96.12 500000338 789997580026.00 36052910 DF 96.12 500000338 789997580026.00 36052910 DF 95.12 500000318 789997580026.00 36052910 DF 95.12 500000318 789997580026.00 36052911 DF 95.12 500000318 789997580026.00 36052911 DF 95.12 //SORTJNF2 DD DSN=T01.RXVD.PULL,DISP=SHR------------------------------> O/p from the above step //SYSIN DD * JOINKEYS FILES=F1,FIELDS=(1,37,A),SORTED,NOSEQCK JOINKEYS FILES=F2,FIELDS=(1,37,A),SORTED,NOSEQCK REFORMAT FIELDS=(F1:01,80,F2:01,92,?) OPTION COPY JOIN UNPAIRED,F1,F2 OUTFIL FNAMES=BOTH, INCLUDE=(173,1,CH,EQ,C'B'),BUILD=(1,80) /* output file generated 500000338 789997580026.00 36052910 DF 96.12 500000338 789997580026.00 36052910 DF 96.12 500000338 789997580026.00 36052910 DF 95.12 The above o/p generated based on the sample file is correct, but I am not sure whether the summarization done in the first step is correct. Regards Ron T ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN