Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
GROUP BY Using DFSORT/ICETOOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Wed Jun 02, 2010 10:43 pm    Post subject: GROUP BY Using DFSORT/ICETOOL
Reply with quote

Hello All,

I have a file which has a LRECL of 10 and contains date values. Looks as follows:

2009-05-31
2009-05-31
2009-05-31
2008-05-31
2008-05-31
2006-05-31

I want to acheive the function of GROUP BY in SQL using SORT and get the unique date values along with the number of occurence. The output should look like:

2009-05-313
2008-05-312
2006-05-311

Kindly let me know if any of you know of how to accomplish the same or any other thread which discusses a similar topic

Thanks in advance.

Arvind
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 02, 2010 11:06 pm    Post subject: Reply to: GROUP BY Using DFSORT/ICETOOL
Reply with quote

rarvins,

Assuming that your input is already sorted on date field, the following JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
2009-05-31                                               
2009-05-31                                               
2009-05-31                                               
2008-05-31                                               
2008-05-31                                               
2006-05-31                                               
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  OUTFIL REMOVECC,NODETAIL,BUILD=(15X),                           
  SECTIONS=(1,10,TRAILER3=(1,10,X,COUNT=(M10,LENGTH=4)))
//*


the output from this is
Code:

2009-05-31    3
2008-05-31    2
2006-05-31    1
Back to top
View user's profile Send private message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Thu Jun 03, 2010 3:26 am    Post subject:
Reply with quote

Thanks a lot SKolusu... it worked
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Formatting using DFsort Guru Nandu DFSORT/ICETOOL 5 Thu Nov 30, 2017 7:33 am
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts ICETOOL - RESIZE DYNAMICALLY kranthikumarb DFSORT/ICETOOL 0 Tue Nov 21, 2017 5:30 pm
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us