Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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
Author Message
Gnanas SNG

Senior Member


Joined: 06 Sep 2007
Posts: 440
Location: 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
References
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 121
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 SNG

Senior Member


Joined: 06 Sep 2007
Posts: 440
Location: 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
Moved: Thu May 22, 2008 6:37 pm by superk From DFSORT/ICETOOL to JCL
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 121
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 SNG

Senior Member


Joined: 06 Sep 2007
Posts: 440
Location: 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: 121
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: 162
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL All times are GMT + 6 Hours
Page 1 of 1