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

DFSORT to know the record count


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Wed Sep 29, 2010 5:29 pm
Reply with quote

How can I know the record count for HDR1,HDR2 and so on
for key start with pos 4 lenth 3 which is AB1 and 14th pos A1 records

FB LRECL=80
Input File:-
Code:

##HDR0001##
000AB1   xxxxx   A1
000AB3   xxxxx   C1
000AB1   xxxxx   A1
000AB1   xxxxx   A2
000AB2   xxxxx   C1
##TRL##
##HDR0002##
000AB1   xxxxx   A1
000AB3   xxxxx   C1
000AB1   xxxxx   A1
000AB1   xxxxx   A1
000AB2   xxxxx   C1
##TRL##


The output shoud be
Code:
##HDR0001##     2
##HDR0002##     3
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Wed Sep 29, 2010 8:26 pm
Reply with quote

shrivatsa,
Unless I am missing something, do you always want a count of AB1 and A1 records or should output have count for all the keys? What about AB3, C1 and AB2,C1 records under HDR0001?

Thanks,
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Wed Sep 29, 2010 9:05 pm
Reply with quote

I need count of only AB1 and A1 records.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Wed Sep 29, 2010 9:24 pm
Reply with quote

shrivatsa,
See if below jcl works for you...
Code:

//STEP01   EXEC PGM=SORT                                               
//SORTIN   DD   *                                                       
##HDR0001##                                                             
000AB1   XXXXX   A1                                                     
000AB3   XXXXX   C1                                                     
000AB1   XXXXX   A1                                                     
000AB1   XXXXX   A2                                                     
000AB2   XXXXX   C1                                                     
##TRL##                                                                 
##HDR0002##                                                             
000AB1   XXXXX   A1                                                     
000AB3   XXXXX   C1                                                     
000AB1   XXXXX   A1                                                     
000AB1   XXXXX   A1                                                     
000AB2   XXXXX   C1                                                     
##TRL##                                                                 
//SORTOUT  DD  SYSOUT=*                                                 
//SYSIN DD *                                                           
 OPTION COPY                                                           
 INCLUDE COND=((1,5,CH,EQ,C'##HDR'),OR,                                 
               (4,3,CH,EQ,C'AB1',AND,18,2,CH,EQ,C'A1'))                 
 INREC IFTHEN=(WHEN=GROUP,                                             
               BEGIN=(1,5,CH,EQ,C'##HDR'),PUSH=(52:1,11))               
 OUTFIL REMOVECC,NODETAIL,SECTIONS=(52,11,                             
                          TRAILER3=(52,11,COUNT-1=(M10,LENGTH=8)))     
/*                                                                     
//SYSOUT DD SYSOUT=*                                                   
//*                                                                     

OUTPUT
Code:
##HDR0001##       2
##HDR0002##       3


Thanks,
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Fri Oct 01, 2010 9:46 am
Reply with quote

Thanks for the below solution but there is slight modification in input file
as I want count based on the A1 group as below

Code:
##HDR0001##                                                             
000AB1   XXXXX   A1                                                     
000AB3   XXXXX   A1                                                     
000AB1   XXXXX   A1                                                     
000AB1   XXXXX   A2                                                     
000AB2   XXXXX   C1
000AB3   XXXXX   A1                                                         
##TRL##                                                                 
##HDR0002##                                                             
000AB1   XXXXX   A1                                                     
000AB3   XXXXX   C1                                                     
000AB1   XXXXX   A1                                                     
000AB1   XXXXX   A1                                                     
000AB2   XXXXX   C1
000AB3   XXXXX   A1     
000AB3   XXXXX   A1                                                         
##TRL##   



Output is

Code:
##HDR0001##     
000AB1      2
000AB3      2
##HDR0002##     
000AB1      3
000AB3      2
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Oct 01, 2010 9:53 am
Reply with quote

Hello,

Talk with others on your project and make sure you now have posted the complete requirement.

It is just a waste of everyone's time and effort to ask for incremental changes. . .
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Oct 01, 2010 9:20 pm
Reply with quote

shrivatsa,
See if below jcl works for you...
Code:

//SORT01   EXEC PGM=SORT                                               
//SORTIN   DD *                                                         
##HDR0001##                                                             
000AB1   XXXXX   A1                                                     
000AB3   XXXXX   A1                                                     
000AB1   XXXXX   A1                                                     
000AB1   XXXXX   A2                                                     
000AB2   XXXXX   C1                                                     
000AB3   XXXXX   A1                                                     
##TRL##                                                                 
##HDR0002##                                                             
000AB1   XXXXX   A1                                                     
000AB3   XXXXX   C1                                                     
000AB1   XXXXX   A1                                                     
000AB1   XXXXX   A1                                                     
000AB2   XXXXX   C1                                                     
000AB3   XXXXX   A1                                                     
000AB3   XXXXX   A1                                                     
##TRL##                                                                 
//SORTOUT  DD  SYSOUT=*                                                 
//SYSIN DD *                                                           
 INCLUDE COND=(18,2,CH,EQ,C'A1',OR,1,5,CH,EQ,C'##HDR')                 
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'##HDR'),                   
                          PUSH=(83:1,11)),                             
       IFTHEN=(WHEN=(1,5,CH,NE,C'##HDR'),                               
                          OVERLAY=(12:10,71,10:2X,94:C'1'))             
 SORT FIELDS=(83,11,CH,A,1,11,CH,A),EQUALS                             
 OUTFIL REMOVECC,NODETAIL,SECTIONS=(01,11,                             
        TRAILER3=(1,11,4X,TOTAL=(94,1,ZD,EDIT=(III))))                 
/*                                                                     
//SYSOUT DD SYSOUT=*                                                   
//*                                                                     

OUTPUT
Code:
##HDR0001##       
000AB1           2
000AB3           2
##HDR0002##       
000AB1           3
000AB3           2

Thanks,
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts count contained values of several col... DB2 5
No new posts DB2 Query to get the count of Unique ... DB2 2
No new posts DFSORT Join Keys Controlcard DFSORT/ICETOOL 4
No new posts To Discard record with 0 entry if Dup... SYNCSORT 7
No new posts To Populate Trailer cnt in the file w... SYNCSORT 1
Search our Forums:


Back to Top