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

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


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

New User


Joined: 27 Dec 2006
Posts: 36
Location: Chennai

PostPosted: Mon Jul 07, 2008 10:01 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Jul 07, 2008 11:07 pm
Reply with quote

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
View user's profile Send private message
mukunthg

New User


Joined: 27 Mar 2007
Posts: 10
Location: India

PostPosted: Wed Jul 09, 2008 9:16 pm
Reply with quote

Could you please explain what LIST and BLANK will do?

Thanks,
Mukunth,G
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: Wed Jul 09, 2008 10:07 pm
Reply with quote

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:

Use [URL] BBCode for External Links
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 and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top