Page 1 of 1

Add count based on the date.

Posted: Mon Jun 27, 2016 3:30 pm
by Nitin Gadge
Hi,
I have been working out to get an output like this but not getting it worked.

Code: Select all

02/03/2016 3
02/02/2016 2
Where the input file looks like this:

Code: Select all

02/03/2016 123456791
02/03/2016 347898292
02/03/2016 666536724
02/02/2016 123489646
02/02/2016 141456878
How can I get it working? Please advise.

Re: Add count based on the date.

Posted: Mon Jun 27, 2016 6:03 pm
by enrico-sorichetti
How can I get it working? Please advise.
doing it in the right way ( with the appropriate sort control statements)

You asked for it...
You are complaining that something You are trying to do does not work,
how in hell(*) are we supposed to know what You have done wrong and help You to fix it if You do tot tell

(*) foul language for this kind of questions is universally accepted on any forum.

we reply on our own time and free of charge, so we expect better judgement from people asking US to solve THEIR problems.

Re: Add count based on the date.

Posted: Mon Jun 27, 2016 9:47 pm
by nicc
I suggest you read the manual. Then show what you tried and if it worked or not. If it did not work show the error messages or the incorrect SORTOUT data set.

Re: Add count based on the date.

Posted: Mon Jun 27, 2016 10:49 pm
by William Collins
Look especially at the OUTFIL reporting features, SECTIONS with COUNT (and NODETAIL,REMOVECC).

Re: Add count based on the date.

Posted: Thu Jul 07, 2016 11:19 am
by Nitin Gadge
Thanks William. SECTIONS and COUNT has worked.

Re: Add count based on the date.

Posted: Thu Jul 07, 2016 11:28 am
by Anuj Dhawan
If you can share the final solution you have used, it might help many of us.

Re: Add count based on the date.

Posted: Thu Jul 14, 2016 9:13 pm
by Nitin Gadge
I used it like first:

Code: Select all

//STEP010   EXEC  PGM=ICETOOL 
//TOOLMSG  DD  SYSOUT=*                                
//DFSMSG   DD  SYSOUT=*                                
//INPUT    DD  *                                      
02/03/2016 123456791
02/03/2016 347898292
02/03/2016 666536724
02/02/2016 123489646
02/02/2016 141456878
/*                                                    
//TEMP1    DD  DSN=&&T1,DISP=(,PASS)                  
//OUTPUT   DD  SYSOUT=*                                
//TOOLIN   DD  *                                      
 SELECT FROM(INPUT)  TO(TEMP1)  ON(1,10,CH)  FIRST    
 SORT   FROM(TEMP1)  TO(OUTPUT) USING(CTL1)          
//CTL1CNTL DD  *                                      
 INREC FIELDS=(1,10,2X,C'00000001')                  
 SORT FIELDS=(1,10,CH,A)                              
 SUM FIELDS=(13,8,ZD)                                
 OUTREC FIELDS=(1,10,,2X,13,8)                          
/*
And this

Code: Select all

//STEP0100 EXEC PGM=SORT      
//SYSOUT   DD SYSOUT=*        
//SORTIN   DD *              
02/03/2016 123456791
02/03/2016 347898292
02/03/2016 666536724
02/02/2016 123489646
02/02/2016 141456878
/*
//SORTOUT  DD SYSOUT=*        
//SYSIN    DD *              
  SORT FIELDS=(1,10,CH,A)
  SUM FIELDS=NONE            
  OUTFIL REMOVECC,NODETAIL,  
  SECTIONS=(1,10,            
  TRAILER3=(1,10,COUNT))      
/* 

Re: Add count based on the date.

Posted: Sat Jul 16, 2016 11:09 am
by Anuj Dhawan
Thanks for posting what has worked for you! Appreciate that.

Re: Add count based on the date.

Posted: Sun Sep 04, 2016 9:25 pm
by Magesh_j
Nitin Gadge,

why do you need a SORT FIELDS when the file is already in sorted order 1,10.

SUM FIELDS=NONE will remove all your duplicates record,you will not get the desired output.

use the below code to get the desired results.

Code: Select all

//SYSIN    DD *                  
  OPTION COPY                    
  OUTFIL REMOVECC,NODETAIL,      
  SECTIONS=(1,10,                
  TRAILER3=(1,10,COUNT))         
/*                               
Thanks
Magesh