IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Find the count using sort in JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 2481
Location: @my desk

PostPosted: Fri Aug 07, 2009 1:05 pm
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
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
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
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: 2481
Location: @my desk

PostPosted: Mon Aug 10, 2009 12:00 pm
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: 8797
Location: Welsh Wales

PostPosted: Mon Aug 10, 2009 1:29 pm
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
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: 8797
Location: Welsh Wales

PostPosted: Mon Aug 10, 2009 3:30 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts To get the count of rows for every 1 ... DB2 3
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top