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
 
Find the count using sort in JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ksank01

New User


Joined: 23 Jun 2009
Posts: 1
Location: India

PostPosted: Fri Aug 07, 2009 12:57 pm    Post subject: Find the count using sort in JCL
Reply with quote

Hi,

I need to get the count of records with a particular key.

Input file
AAAOO XHJXK
AAAOO DHUDJ
AAAPP KJHKJ
BBBOO ASLKO
BBBPP ASKJAD
BBBPP GHLKDJF

Output required is
AAAOO 2
AAAPP 1
BBBOO 1
BBBPP 2

Can this be done using a SORT?
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2285
Location: @my desk

PostPosted: Fri Aug 07, 2009 1:05 pm    Post subject:
Reply with quote

Quote:
Can this be done using a SORT?
Hello,

If you're looking for a SORT solution, it should be posted in the JCL(If you have SyncSort) or DFSORT forum based on the product you have. Keep this in mind next time when you start a new topic.

I think this topic has been discussed before many times. Try SEARCHing the forum for working examples.
Back to top
View user's profile Send private message
venkatesh83be

New User


Joined: 10 Aug 2009
Posts: 12
Location: Chennai

PostPosted: Mon Aug 10, 2009 9:46 am    Post subject: Reply to: Find the count using sort in JCL
Reply with quote

HI ksank01,

Did you get a solution for ur query...
Back to top
View user's profile Send private message
venkatesh83be

New User


Joined: 10 Aug 2009
Posts: 12
Location: Chennai

PostPosted: Mon Aug 10, 2009 10:45 am    Post subject: Reply to: Find the count using sort in JCL
Reply with quote

Hi ksank01,

You can achieve this in 2 SORT steps as in attached doc..
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Aug 10, 2009 11:07 am    Post subject:
Reply with quote

Hi venkatesh83be,
Its very simple to copy-paste your code here instead of taking print screen and attaching as document.
Copy paste with using code tag makes is readable.
Please see the way output is required and also it does not required two steps to do so..

Hi ksank01,
Solution for such requirement is already posted on this forum so many times.
below step will give you desired result.
Code:

//S1    EXEC  PGM=SORT                                     
//SYSOUT    DD  SYSOUT=*                                   
//SORTIN DD *                                             
AAAOO XHJXK                                               
AAAOO DHUDJ                                               
AAAPP KJHKJ                                               
BBBOO ASLKO                                               
BBBPP ASKJAD                                               
BBBPP GHLKDJF                                             
/*                                                         
//SORTOUT DD SYSOUT=*                                     
//SYSIN    DD    *                                         
  SORT FIELDS=(1,5,CH,A)                                   
  OUTFIL REMOVECC,NODETAIL,                               
  SECTIONS=(1,5,TRAILER3=(1,5,COUNT=(M10,LENGTH=2)))       
/*                                                         
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2285
Location: @my desk

PostPosted: Mon Aug 10, 2009 12:00 pm    Post subject:
Reply with quote

Quote:
it does not required two steps to do so
venkatesh83be,

And the code posted will NOT give the desired results if the count exceeds single digit.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Aug 10, 2009 1:29 pm    Post subject:
Reply with quote

venkatesh83be

Please do not post attachments as not everyone is permitted to download / open them.
Back to top
View user's profile Send private message
venkatesh83be

New User


Joined: 10 Aug 2009
Posts: 12
Location: Chennai

PostPosted: Mon Aug 10, 2009 3:16 pm    Post subject:
Reply with quote

Hi friends,

Hmm sure, will post hereafter based on your comments...
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Aug 10, 2009 3:30 pm    Post subject:
Reply with quote

If you have DFSORT, try this
Code:

//ICETOOL1 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//INFILE   DD DSN=Your input dataset,DISP=SHR                           
//OUFILE   DD SYSOUT=*                                           
//TOOLIN   DD *                                                 
 OCCURS FROM(INFILE) LIST(OUFILE) NOHEADER ON(Start,Length,Format) ON(VALCNT)
/*
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm

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