MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need counts

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Robo2005
Beginner


Joined: 13 Jul 2005
Posts: 11
Topics: 3

PostPosted: Fri Aug 19, 2005 2:32 pm    Post subject: Need counts Reply with quote

Hi,

I am using Syncsort. My file length is 80 bytes and FB.
It has two fields. Field1 has one byte length and has values either A or B.
Field2 has 4 bytes length and could be any value. My file is sorted based
field2 and field1.

input
Code:

----+----1-
***********
A 0011
A 0011
A 0011
B 0011
B 0011
A 0022
A 0022
B 0022
A 0123
A 0123
A 0123
B 0123
B 0123     


Now I need the counts of A and B for each value in field2.
The o/p shld be
Code:

0011 - A Count is 3 and B count is 2
0022 - A Count is 2 and B count is 1
0123 - A Count is 3 and B count is 2

 


The values in field2 could be any values.

Please help me.

Thanks
Robo.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Fri Aug 19, 2005 4:19 pm    Post subject: Reply with quote

Robo,

The following JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD *             
A 0011                       
A 0011                       
A 0011                       
B 0011                       
B 0011                       
A 0022                       
A 0022                       
B 0022                       
A 0123                       
A 0123                       
A 0123                       
B 0123                       
B 0123                       
//SORTOUT  DD SYSOUT=*       
//SYSIN    DD *                                           
  SORT FIELDS=(3,4,CH,A)                                 
  OUTREC FIELDS=(1,6,                                     
                7:1,1,CHANGE=(1,C'A',C'1'),NOMATCH=(C'0'),
                8:1,1,CHANGE=(1,C'B',C'1'),NOMATCH=(C'0'),
                80:X)                                     
  OUTFIL REMOVECC,NODETAIL,                               
  SECTIONS=(3,4,                                         
  TRAILER3=(3,4,                                         
            C' A COUNT IS ',                             
            TOT=(7,1,ZD,EDIT=(IIIIIIIT)),                 
            C' AND B COUNT IS ',                         
            TOT=(8,1,ZD,EDIT=(IIIIIIIT))))               
/*                                                       


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Robo2005
Beginner


Joined: 13 Jul 2005
Posts: 11
Topics: 3

PostPosted: Mon Aug 22, 2005 1:29 pm    Post subject: Reply with quote

Kolusu,

Thank you verymuch. It is working fine as expected.
Could you please tell me where can I find Syncsort material.


Thanks
Robo.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Mon Aug 22, 2005 2:15 pm    Post subject: Reply with quote

Quote:

Thank you verymuch. It is working fine as expected. Could you please tell me where can I find Syncsort material.


Syncsort manuals are not available online. If your shop has a valid licence then you can request manuals from syncsort Inc.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group