Display Filed value with counts.

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
mpawan
Member
Posts: 9
Joined: Mon Jan 18, 2010 2:06 pm
Location: Hyderabad

Display Filed value with counts.

Post by mpawan » Wed Dec 15, 2010 4:54 pm

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)
Thanks & Regards
M Pawan

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Dec 15, 2010 5:48 pm

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.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

mpawan
Member
Posts: 9
Joined: Mon Jan 18, 2010 2:06 pm
Location: Hyderabad

Post by mpawan » Wed Dec 15, 2010 8:06 pm

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.
Thanks & Regards
M Pawan

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Dec 15, 2010 11:08 pm

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
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

mpawan
Member
Posts: 9
Joined: Mon Jan 18, 2010 2:06 pm
Location: Hyderabad

Post by mpawan » Thu Dec 16, 2010 1:33 pm

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.
Thanks & Regards
M Pawan

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Thu Dec 16, 2010 1:59 pm

you are using SYNCSORT, not DFSORT
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

mpawan
Member
Posts: 9
Joined: Mon Jan 18, 2010 2:06 pm
Location: Hyderabad

Post by mpawan » Thu Dec 16, 2010 2:36 pm

Hi,

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

Can we use SYNCSORT for above requirement?
Thanks & Regards
M Pawan

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Dec 16, 2010 9:20 pm

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.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Tue Dec 28, 2010 4:08 pm

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...
Regards,
Anuj

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Tue Dec 28, 2010 4:10 pm

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)
Regards,
Anuj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others