Elardus Engelbrecht,
As suspected you just need the first record per key. Here is Sample job
which will give you the desired results in 1 pass. I also generated the
report in the same pass of data. SELECT with FIRST will give you the same
results as SORT and SUM FIELDS=NONE
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INOVER DD DISP=SHR,DSN=Your Input VB file
//PRINT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(INOVER) TO(PRINT) ON(28,8,CH) FIRST USING(CTL1)
//*
//CTL1CNTL DD *
INCLUDE COND=(05,10,CH,EQ,C'2015/04/21',AND,
28,03,CH,EQ,C'ABC')
OUTFIL VTOF,REMOVECC,
HEADER2=(PAGE,' USERS ',
DATE=(4MD/),4X,TIME=(24:),/,/,
'USER ID TERMINAL FLAG',/,
'-------- -------- -----'),
BUILD=(01:28,8,
12:36,8,
23:44,5,
80:X)
//*
This will produce an 80 byte FB file like shown below
1 USERS 2015/04/22 10:21:59
USER ID TERMINAL FLAG
-------- -------- -----
ABC007 TERMID.. FLAG1
ABC008 TERMID.. FLAG1
ABC009 TERMID.. FLAG1
ABC010 TERMID.. FLAG2
ABC011 TERMID.. FLAG2
ABC015 TERMID.. FLAG1
If you don't want to code reporting parms by yourself then use the
following
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INOVER DD DISP=SHR,DSN=Your Input VB file
//TEMP0001 DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//PRINT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(INOVER) TO(TEMP0001) ON(28,8,CH) FIRST USING(CTL1)
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')
//CTL1CNTL DD *
INCLUDE COND=(05,10,CH,EQ,C'2015/04/21',AND,
28,03,CH,EQ,C'ABC')
//*
Further if you have any questions please let me know
Thanks,
Kolusu
DFSORT Development
IBM Mainframe Discussion List <[email protected]> wrote on
04/22/2015 10:01:24 AM:
> From: Elardus Engelbrecht <[email protected]>
> To: [email protected]
> Date: 04/22/2015 10:01 AM
> Subject: Re: DFSORT / ICETOOL query about handling duplicats with
> SELECT HIGHER
> Sent by: IBM Mainframe Discussion List <[email protected]>
>
> 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
>
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN