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

How to find out the occurrence of a certain string in a col


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

New User


Joined: 25 Jan 2006
Posts: 27

PostPosted: Fri Dec 01, 2006 3:20 pm
Reply with quote

Hi Frank
Can u please tell me how to find out the occurrence of a certain string in a column? suppose the flat file contains

ASDKJDASKABCSAJKFLGSA
ASDKJDASKABCSAJKFLGSA
ASDKJDASKABCSAJKFLGSA
ASDKJDASKDEFSAJKFLGSA
ASDKJDASKDEFSAJKFLGSA
ASDKJDASKGGGSAJKFLGSA
ASDKJDASKGGGSAJKFLGSA
ASDKJDASKABCSAJKFLGSA
ASDKJDASKDEFSAJKFLGSA


my o/p should have
ABC 4
DEF 3
GGG2
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: Fri Dec 01, 2006 10:17 pm
Reply with quote

You can use the OCCUR operator of DFSORT's ICETOOL to do that. For example:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//RPT DD DSN=...  output file
//TOOLIN DD *
OCCUR FROM(IN) LIST(RPT) NOHEADER ON(10,3,CH) ON(VALCNT,E'99')
/*


For complete information on the OCCUR operator, see:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/6.9?DT=20060615185603
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1210
Location: India

PostPosted: Fri Dec 15, 2006 12:04 pm
Reply with quote

Back to top
View user's profile Send private message
Rajen

New User


Joined: 05 May 2005
Posts: 61

PostPosted: Fri Dec 15, 2006 1:18 pm
Reply with quote

Hi
Below is SYNCSORT Solution.

Code:
//SYSIN     DD *                                         
 INREC   FIELDS=(1,21,C'000001')                         
 SORT    FIELDS=(1,21,CH,A)                             
 SUM     FIELDS=(22,6,ZD)                               
 OUTFIL  REMOVECC,                                       
          HEADER1=('COUNTS OF RECORDS'),                 
          OUTREC=(1:11,3,1X,22,6,ZD,EDIT=(III,IIT),80X) 
/*                                                       


Let me know if it is not clear.

Thanks,
Rajen Patel.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
Search our Forums:

Back to Top