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

DFSORT - Occurance count and write to output


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

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Mon Aug 09, 2010 9:40 pm
Reply with quote

Hi,
I have a input file like this: ID, Desc, Amt
Code:
1111111 ABCDEFGH 100.00
1111111 TSGTWGYW 40.00
1111111 ABCDEFGH 20.00
2222222 TRYUONKP 450.00
2222222 ABCDEFGH 450.00
3333333 ERTGYUER 135.00
4444444 WGJRJYJJ 426.99
4444444 SJRJJEJJ 266.00
1111111 ERTFGYEA 20.00
2222222 TRYUONKP 450.00

Requirement is to have the records from input which has more than 2 occurence of ID (first 7 bytes)

1) I used VALCNT to get the number of occurrences. Worked fine.
Toolin:
Code:
OCCUR FROM(IN1) LIST(TMP1) BLANK HIGHER(2) -
   ON(1,7,CH) ON(VALCNT)                       
  COPY FROM(TMP1) TO(OUT)

Output:
Code:
1(1,7,CH)       VALUE COUNT 
 1111111                  4 
 2222222                  3 


2) Now I need the records of these IDS from the input file. How to get those?
Expected output:
Code:
1111111 ABCDEFGH 100.00
1111111 TSGTWGYW 40.00
1111111 ABCDEFGH 20.00
1111111 ERTFGYEYH 20.00
2222222 TRYUONKP 450.00
2222222 ABCDEFGH 450.00
2222222 TRYUONKP 450.00

Any pointers will be of great help.
Thanks,
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Aug 09, 2010 10:19 pm
Reply with quote

vijikesavan,

Use SELECT ...

Code:
//S1    EXEC  PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                     
//IN      DD *                                             
1111111 ABCDEFGH 100.00                                   
1111111 TSGTWGYW 40.00                                     
1111111 ABCDEFGH 20.00                                     
2222222 TRYUONKP 450.00                                   
2222222 ABCDEFGH 450.00                                   
3333333 ERTGYUER 135.00                                   
4444444 WGJRJYJJ 426.99                                   
4444444 SJRJJEJJ 266.00                                   
1111111 ERTFGYEA 20.00                                     
2222222 TRYUONKP 450.00                                   
//OUT     DD SYSOUT=*                                     
//TOOLIN DD *                                             
 SELECT FROM(IN) TO(OUT) ON(1,07,CH) HIGHER(2)             
/*                                                         


OUTPUT
Code:

1111111 ABCDEFGH 100.00
1111111 TSGTWGYW 40.00 
1111111 ABCDEFGH 20.00 
1111111 ERTFGYEA 20.00 
2222222 TRYUONKP 450.00
2222222 ABCDEFGH 450.00
2222222 TRYUONKP 450.00


Thanks,
Back to top
View user's profile Send private message
vijikesavan

Active User


Joined: 04 Oct 2006
Posts: 118
Location: NJ, USA

PostPosted: Mon Aug 09, 2010 10:32 pm
Reply with quote

Thanks a lot. It worked fine:)
So simple, I cudn't think of it imdlty:)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top