Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Counting number of records based on a key using SYNCSORT

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

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Thu May 22, 2008 5:30 pm    Post subject: Counting number of records based on a key using SYNCSORT
Reply with quote

My shop is using SYNCSORT.

I use this SYSIN for getting number of records based on a key.

Code:
SORT FIELDS=(80,10,CH,A)           
 OUTFIL REMOVECC,NODETAIL,         
      SECTIONS=(80,10,             
          TRAILER3=(80,10,X,COUNT))


Key value starts at 80 byte and runs for 10 bytes.

But I want to get the records which count is 5.
Please let me know what changes can be done on that SYSIn card.
Hope my query is clear.
Back to top
View user's profile Send private message

Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Thu May 22, 2008 5:38 pm    Post subject:
Reply with quote

Are you referring to the number of occurences of the key?

Say key=aaa occurs 10 times and key=bbb occurs 4 times you want to output all the records whose key =aaa ?


Please can you clarify.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Thu May 22, 2008 6:01 pm    Post subject:
Reply with quote

Thanks for your reply.

These are input records.
Code:
....AAAAAAAAA123...
....AAAAAAAAA123...
....AAAAAAAAA123...
....AAAAAAAAA124...
....AAAAAAAAA123...
....AAAAAAAAA123...
....AAAAAAAAA125...
....AAAAAAAAA125...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA300...
....AAAAAAAAA500...
....AAAAAAAAA999...


I want output as below.
Code:
....AAAAAAAAA123  5...
....AAAAAAAAA300  5...


Here I need records with key which occur in 5 times.
Is this okay?
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Thu May 22, 2008 6:51 pm    Post subject:
Reply with quote

Hi Gnanas,

I used this.

Code:

   SORT FIELDS=(1,12,CH,A)                             
    OUTFIL REMOVECC,NODETAIL,                         
         SECTIONS=(1,12,                               
             TRAILER3=(1,12,X,COUNT=(M11,LENGTH=8)))   
 /*                                                   
 //S2    EXEC  PGM=SORT                               
 //SYSOUT    DD  SYSOUT=*                             
 //SORTMSG   DD  SYSOUT=*                             
 //SORTIN DD DSN=IFM4757.SORTTEMP,DISP=SHR             
 //SORTOUT DD DSN=IFM4757.SORTOUT,DISP=SHR             
 //SYSIN   DD    *                                     
   SORT FIELDS=(1,12,CH,A)                             
   INCLUDE COND=(14,8,CH,GE,C'00000005')               
 /*                                                   


Output was:
Code:

AAAAAAAAA123 00000005   
AAAAAAAAA300 00000005   



Can you check and confirm if this meets your requirement.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Thu May 22, 2008 6:56 pm    Post subject:
Reply with quote

Hi Manuneedhi,

Well, can you please let me know why you are sorting in second step also?

Is it possible in one step (instead of two steps)?
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Thu May 22, 2008 7:03 pm    Post subject:
Reply with quote

You could just use OPTION COPY there in the second step, sorting is not required.

Tried doing this in single step but couldn't see it working. I will probably check if it can be done that way.
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Thu May 22, 2008 7:05 pm    Post subject:
Reply with quote

Please check the below code.

Code:

//IN1      DD  *                                   
....AAAAAAAAA123...                               
....AAAAAAAAA123...                               
....AAAAAAAAA123...                               
....AAAAAAAAA124...                               
....AAAAAAAAA123...                               
....AAAAAAAAA123...                               
....AAAAAAAAA125...                               
....AAAAAAAAA125...                               
....AAAAAAAAA300...                               
....AAAAAAAAA300...                               
....AAAAAAAAA300...                               
....AAAAAAAAA300...                               
....AAAAAAAAA300...                               
....AAAAAAAAA500...                               
....AAAAAAAAA999...                               
//OUT1     DD  DSN=xxxx.xxxx.xxxxx.REP1,           
//             DISP=(,CATLG,DELETE),               
//             UNIT=Sysdk,                         
//             SPACE=(TRK,(25,25),RLSE),           
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//OUT2     DD  DSN=xxxx.xxxx.xxxxx.REP2,           
//             DISP=(,CATLG,DELETE),               
//             UNIT=Sysdk,                         
//             SPACE=(TRK,(25,25),RLSE),           
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN   DD  *                                   
   SORT FROM(IN1) TO(OUT1) USING(CTL1)             
   SORT FROM(OUT1) TO(OUT2) USING(CTL2)           
//CTL1CNTL DD  *                                   
   INREC FIELDS=(5,12,C'00000001')                 
   SORT FIELDS=(1,12,CH,A)                         
   SUM FIELDS=(13,8,ZD)                           
   OUTREC FIELDS=(1,12,13,8,ZD,M10,80:X)           
//CTL2CNTL DD  *                                   
   SORT FIELDS=COPY                               
   INCLUDE COND=(20,1,CH,EQ,C'5')                 
/*                                                 

Thanks
Krishy
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 do you create Eclipse based dialogs jasorn IBM Tools 0 Thu Aug 03, 2017 5:05 pm
No new posts Profile changed to NUMBER ON STD (fro... Martylin TSO/ISPF 1 Thu Aug 03, 2017 9:14 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us