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

count the number of records and displaying at the end


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
balakrishna reddy.bala

New User


Joined: 15 Sep 2010
Posts: 17
Location: india

PostPosted: Fri Nov 19, 2010 6:50 pm
Reply with quote

Hi,

I have a problem as mentioned below:

Input File:

1111 AAA A12
1111 AAA A12
1111 AAA A13
1122 AAB B11
1123 BBB C11
1123 BBB C11

Output:

1111 AAA A12 0002
1111 AAA A13 0001
1122 AAB B11 0001
1123 BBB C11 0002
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Nov 20, 2010 12:51 am
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1 EXEC PGM=SORT                               
//SYSOUT DD SYSOUT=*                             
//SORTIN DD *                                     
1111 AAA A12                                     
1111 AAA A12                                     
1111 AAA A13                                     
1122 AAB B11                                     
1123 BBB C11                                     
1123 BBB C11                                     
//SORTOUT DD SYSOUT=*                             
//SYSIN DD *                                     
  SORT FIELDS=(1,12,CH,A)                         
  OUTFIL REMOVECC,NODETAIL,                       
    SECTIONS=(1,12,                               
      TRAILER3=(1,12,X,COUNT=(EDIT=(TTTT))))     
/*


If the records are already in sorted order as shown in your example, using:

Code:

  OPTION COPY


instead of:

Code:

    SORT FIELDS=(...)


would be more efficient.
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 Format data from multiple records usi... SYNCSORT 4
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 Sort SMF records? SYNCSORT 6
No new posts To Sort detail records in a file with... SYNCSORT 5
Search our Forums:


Back to Top