IBM MAINFRAME HELP FORUMS for COBOL, JCL, CICS, DB2, IMS etc...
Help & Support Forums for IBM Mainframe computers Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7, CA-11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, VSAM, ISPF, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Need to get count of the records based on a particular field

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
View previous topic :: View next topic  
Author Message
nagarajan.dharani



Joined: 27 Dec 2006
Posts: 30
Location: Chennai

Posted: Mon Jul 07, 2008 10:01 pm    Post subject: Need to get count of the records based on a particular field  

Hi,

Could anyone please help me in the following requirement.

I have a file with the following records

Field1 Field2
------ ------
234 trwtooo
234 prwtroo
234 yiirueur
567 grsgdgd
567 gedsgdf
567 gdgsgsg
567 gdsgsgs
668 gdfgfdg

I need to get the count of records based on field1

My output should be like

field1 count
------ ------
234 3
567 4
668 1

Thanks in advance for all the help

Thanks,
Dharani
Back to top  
Frank Yaeger



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

Posted: Mon Jul 07, 2008 11:07 pm    Post subject:  

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:
//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file
//OUT DD SYSOUT=*
//TOOLIN DD *
OCCUR FROM(IN) LIST(OUT) BLANK -
 HEADER('Field1') ON(1,3,CH) -
 HEADER('Count') ON(VALCNT,U06)
/*
Back to top  
mukunthg



Joined: 27 Mar 2007
Posts: 8
Location: India

Posted: Wed Jul 09, 2008 9:16 pm    Post subject: Reply to: Need to get count of the records based on a partic  

Could you please explain what LIST and BLANK will do?

Thanks,
Mukunth,G
Back to top  
Frank Yaeger



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

Posted: Wed Jul 09, 2008 10:07 pm    Post subject:  

From "z/OS DFSORT Application Programming Guide":

LIST(listdd)
Specifies the ddname of the list data set to be produced by ICETOOL for this operation. A listdd DD statement must be present.

BLANK
Specifies an alternate format for printing character and numeric data as follows:

Numeric values for which formatting is not specified are printed with blank for plus sign, - for minus sign and no leading zeros (overriding the default of + for plus sign and leading zeros).

Column widths are dynamically adjusted according to the length of the headings and the maximum number of bytes needed for the character or numeric data

Headings and data for numeric fields are right-justified (overriding the default of left-justified headings and data for numeric fields)

You can access all of the DFSORT books from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> DFSORT/ICETOOL
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM
Related Links