Add count based on the date.

IBM's Sort Product, ICETOOL, ICEMAN and ICEGENER.
Post Reply
Nitin Gadge
Registered Member
Posts: 27
Joined: Tue Aug 20, 2013 11:32 am

Add count based on the date.

Post 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.
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 825
Joined: Wed Sep 11, 2013 3:57 pm

Re: Add count based on the date.

Post 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.
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Add count based on the date.

Post 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.
Regards
Nic
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Add count based on the date.

Post by William Collins »

Look especially at the OUTFIL reporting features, SECTIONS with COUNT (and NODETAIL,REMOVECC).
Nitin Gadge
Registered Member
Posts: 27
Joined: Tue Aug 20, 2013 11:32 am

Re: Add count based on the date.

Post by Nitin Gadge »

Thanks William. SECTIONS and COUNT has worked.
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Add count based on the date.

Post by Anuj Dhawan »

If you can share the final solution you have used, it might help many of us.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Nitin Gadge
Registered Member
Posts: 27
Joined: Tue Aug 20, 2013 11:32 am

Re: Add count based on the date.

Post 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))      
/* 
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Add count based on the date.

Post by Anuj Dhawan »

Thanks for posting what has worked for you! Appreciate that.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Magesh_j
Registered Member
Posts: 33
Joined: Sun Sep 04, 2016 8:50 pm

Re: Add count based on the date.

Post 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
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DFSort, ICETOOL, ICEMAN, ICEGENER.”