Page 1 of 1

Display Filed value with counts.

Posted: Wed Dec 15, 2010 4:54 pm
by mpawan
Hi,

I have a file in which the data is as follows:

20000
30000
20000
40000
20000
30000
40000
20000
40000
30000
20000
20000
40000
40000
30000
40000
40000

Can we sort the above file through which i can get a o/p file as below:

30000 4 (i.e. No. of occurence of 30000)
20000 6 (i.e. No. of occurence of 30000)
40000 7 (i.e. No. of occurence of 30000)

Posted: Wed Dec 15, 2010 5:48 pm
by dbzTHEdinosauer
there is a preview button that you can use to preview your post,
thus insuring that what you have written at least makes sense, if not accurate.

Posted: Wed Dec 15, 2010 8:06 pm
by mpawan
I have a input file which has a redundant data. The field description is as follows:

Event No. Description

And the records in the file are as follows:

20000 ABC
30000 DEF
20000 GHI
40000 IJK
20000 LMN
30000 OPQ

Now i need a sort parameter by which we can count all the occurence of all events, neglecting other fields.

For above input records my output file should be having the following data

20000 3
30000 2
40000 1

i.e. first field will give the event no. and second will give count of the occurance of the event.

Posted: Wed Dec 15, 2010 11:08 pm
by Frank Yaeger
You can use the OCCUR operator of DFSORT's ICETOOL to do this quite easily. For example:

Code: Select all

//S1    EXEC  PGM=ICETOOL                                  
//TOOLMSG DD SYSOUT=*                                      
//DFSMSG  DD SYSOUT=*                                      
//IN DD DSN=...  input file                        
//RPT DD SYSOUT=*                                          
//TOOLIN   DD   *                                          
OCCUR FROM(IN) LIST(RPT) ON(1,5,CH) ON(VALCNT,U03)         
/*                                                         
You can format the output the way you want.

For complete details, see:

http://publibz.boulder.ibm.com/cgi-bin/ ... 0630155256

Posted: Thu Dec 16, 2010 1:33 pm
by mpawan
Hi Frank,

I have coded my jcl as:

Code: Select all

//STEP     EXEC  PGM=ICETOOL                              
//TOOLMSG  DD SYSOUT=*                                    
//DFSMSG   DD SYSOUT=*                                    
//SYSOUT   DD SYSOUT=*                                    
//FILEIN   DD DSN=TEST.FILEIP,                            
//            DISP=SHR                                    
//REPORT   DD SYSOUT=*                                    
//TOOLIN   DD *                                           
OCCUR FROM(FILEIN) LIST(REPORT) ON(1,5,CH) ON(VALCNT,U03) 
/*                                                        
But i am getting error as:

Code: Select all

********************************* TOP OF DATA **********************************
SYT000I  SYNCTOOL RELEASE 1.6.2 - COPYRIGHT 2007  SYNCSORT INC.                 
SYT001I  INITIAL PROCESSING MODE IS "STOP"                                      
SYT002I  "TOOLIN" INTERFACE BEING USED                                          
                                                                                
         OCCUR FROM(FILEIN) LIST(REPORT) ON(1,5,CH) ON(VALCNT,U03)              
SYT050E  INVALID OPERAND ON "OCCUR" STATEMENT                                   
SYT030I  OPERATION COMPLETED WITH RETURN CODE 12                                
                                                                                
SYT015I  PROCESSING MODE CHANGED FROM "STOP" TO "SCAN" DUE TO OPERATION FAILURE 
                                                                                
SYT004I  SYNCTOOL PROCESSING COMPLETED WITH RETURN CODE 12                      
******************************** BOTTOM OF DATA ********************************
am i missing anything.

Posted: Thu Dec 16, 2010 1:59 pm
by dbzTHEdinosauer
you are using SYNCSORT, not DFSORT

Posted: Thu Dec 16, 2010 2:36 pm
by mpawan
Hi,

I have consulted with my colleagues, and found that only SYNCSORT is installed in our system.

Can we use SYNCSORT for above requirement?

Posted: Thu Dec 16, 2010 9:20 pm
by Frank Yaeger
My job works fine with DFSORT's ICETOOL, but as you now know you're using Syncsort, not DFSORT.

I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.

Posted: Tue Dec 28, 2010 4:08 pm
by Anuj Dhawan
What release of SyncSort are you at? With SYNCTOOL RELEASE 1.6.2, there should not be an error with OCCUR. Looks like you are not telling us everthing...

Posted: Tue Dec 28, 2010 4:10 pm
by Anuj Dhawan
okay, I see the problem - do you leave any space between any of the "ON" operator - if yes, that's not an acceptable syntax:

Code: Select all

ON(1,5,CH) ON(VALCNT,U03)