Sri h Kolusu very kindly wrote: >As suspected you just need the first record per key.
Yes. It is so for this specific subsetting reporting. >So I am not sure as to what you are trying to accomplish with Higher(0). After my first attempts failed with countless variations of FIRST, FIRST(<value>), HIGHER, ALLDUPS, etc failed, I tried out HIGHER(0) to see what happens. Rewriting the paragraph, I assumed this (replacing x with 0): "HIGHER(0) - Limits the records selected to those with ON values that occur more than 0 times (value count > 0)." So, I tried value > 0 to get records which appeared more than 0, thus one or more times. (Side note - Now I'm wondering, why not value >= x instead value > x?) Eventually I see that I specified, in my first post, SORT FIELDS=(??,8,CH,A) in xxxCNTL and also ON(??,8,CH) in SELECT in TOOLIN DD. That was probably the main problem. >If your intention is to get only 1 record per key or get the first record from >the duplicates, you can use FIRST or LOWER(2). I took your sample, rewrote my job from scratch and I got my desired results after comparing with ALLDUPS and NODUPS and also without handling duplicates. Your sample below is working! >//TOOLIN DD * > SELECT FROM(INOVER) TO(TEMP0001) ON(28,8,CH) FIRST USING(CTL1) > DISPLAY FROM(TEMP0001) LIST(PRINT) - ... etc ... >//CTL1CNTL DD * > INCLUDE COND=(05,10,CH,EQ,C'2015/04/21',AND,28,03,CH,EQ,C'ABC') Many thanks for your kind help. I also finally found the records should be sorted properly on key = ON(28,8,CH) before you can use FIRST, LOWER, etc. Is it true the records should be pre-sorted in this pass or previous pass for FIRST, LOWER, etc to be working correctly? More side notes: I tried out LOWER(2) just to see what happens, as you also suggested, but my output got trimmed very heavily (as expected), so I eventually dropped LOWER. Many thanks again for you kind help. Now, I'm SORTed out! ;-D Groete / Greetings Elardus Engelbrecht ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
