Sri h Kolusu kindly wrote:

>HIGHER(0) will give you ALL the records for the key at 23 for a length of 8 
>bytes as if the key exists then the counter will be 1 which is greater than 0. 
>So I am not sure as to what you are trying to accomplish with Higher(0). 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 tried variations of HIGHER, FIRST, FIRST(<value>), LOWER(<value>) ALLDUPS, 
NODUPS without any luck.
I already have working jobs which show me duplicates or unique records.


>Just so you know you don't need a SORT and a SELECT operator as you can get 
>everything in a single pass of data. Also I noticed that your SORTCNTL has 
>VLSHRT parm , so I am assuming your Input is a VB file ?

It is indeed VB. I work with them every day.

I need several passes because the output in the different TEMP datasets are 
processed differently.

> if your input is indeed VB then your INCLUDE conditions are checking the RDW 
> instead of the data fields.  If your input has RECFM=F, then you really don't 
> need VLSHRT ( it of course will be ignored by DFSORT)

That I'm aware of, thanks. Magic number is 4 for alignment. [1] 


>If you can show me a sample of input and desired output along with the DCB 
>properties, then I will show you a simple and efficient way to get the desired 
>results.

Of course:

Input (some details were masked before posting):

Note - the offsets are somewhat different than in my first post. Below is what 
is now working.

Date/time/SID/Id/Terminal/Flag - RECFM=VB, LRECL=80, DSORG=PS

2015/04/2113:49:57SMFIDABC007  TERMID..FLAG1
2015/04/2113:49:11SMFIDABC007  TERMID..FLAG1
2015/04/2112:38:29SMFIDABC008  TERMID..FLAG1
2015/04/2112:12:11SMFIDABC008  TERMID..FLAG1
2015/04/2112:28:51SMFIDABC008  TERMID..FLAG1
2015/04/2112:38:41SMFIDABC009  TERMID..FLAG1
2015/04/2113:48:51SMFIDABC010  TERMID..FLAG2
2015/04/2113:48:32SMFIDABC010  TERMID..FLAG2
2015/04/2112:31:57SMFIDABC010  TERMID..FLAG2
2015/04/2113:48:12SMFIDABC010  TERMID..FLAG2
2015/04/2113:50:12SMFIDABC011  TERMID..FLAG2
2015/04/2112:28:51SMFIDABC015  TERMID..FLAG1
2015/04/2112:16:11SMFIDABC015  TERMID..FLAG1
2015/04/2113:48:29SMFIDABC015  TERMID..FLAG1
2015/04/2112:29:05SMFIDABC015  TERMID..FLAG1
2015/04/2113:50:02SMFIDABC015  TERMID..FLAG1
         
Note - ABC009 and ABC011 are appearing ONCE, but I want them to be included. 
The ids are the primary KEY.

Expected output with below job:
                                   
- 1 -        USERS        
                          
USER ID    TERMINAL   FLAG
--------   --------   ----
ABC007     TERMID..   FLAG1
ABC008     TERMID..   FLAG1
ABC009     TERMID..   FLAG1
ABC010     TERMID..   FLAG2
ABC011     TERMID..   FLAG2
ABC015     TERMID..   FLAG1

All and every unique ids are shown in the output whether they were used once or 
many times during reporting period.

Currently I got my output with SUM FIELDS=NONE, but not with SELECT ... 
HIGHER(0).

Working ICETOOL / DFSORT statements:

//TOOLIN   DD *                                          
 SORT    FROM(INVOER) TO(TEMP0001) USING(SORT)           
 DISPLAY FROM(TEMP0001) LIST(PRINT) -                    
         PAGE -                                          
         TITLE('USERS') -
         DATE(4MD/) -                                    
         TIME(24:) -                                     
         BLANK -                                         
         ON(28,8,CH) HEADER('USER ID') -                 
         ON(36,8,CH) HEADER('TERMINAL') -  
         ON(44,4,CH) HEADER('FLAG')                 
//SORTCNTL   DD *                                        
 OPTION VLSHRT                                           
 SORT FIELDS=(28,8,CH,A)                                 
 SUM FIELDS=NONE                                         
 INCLUDE COND=(05,10,CH,EQ,C'2015/04/21',AND,            
              (28,03,CH,EQ,C'ABC')) 

TIA for sorting me out. Much appreciated.

Groete / Greetings
Elardus Engelbrecht

[1] - One of my colleagues argued with me the magic number is 5, not 4. Until I 
show him that SDSF adds a magic column to the left (ANSI printer control 
column.)  :-D   :-D

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to