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

Count the number of occurances in a input file using Sort


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

New User


Joined: 06 Feb 2009
Posts: 23
Location: India

PostPosted: Wed Apr 08, 2009 11:11 pm
Reply with quote

I have a requirement, i have an input file as below

001 11 kajdkasd
002 11 dlksldakas
005 11 sdaslkdl
003 11 jsdkjfksdj
004 02 lkdlas
006 02 ldkasldk
008 13 djksdksd

here I need to get the output as below.

in count 11 : 4
count 02: 2
count 13:1

Regards,
Anand
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 08, 2009 11:18 pm
Reply with quote

Is Count the amount of records for everycode close?
Back to top
View user's profile Send private message
anandkumarrn

New User


Joined: 06 Feb 2009
Posts: 23
Location: India

PostPosted: Thu Apr 09, 2009 12:03 am
Reply with quote

Hi CICS Guy,

Thanks for your timely help,

But i am facing a problem, the output count is not equal to the input records,
say i have a input file with 111964 and in output it gives 111979 records.
so there is a mismatch between these two counts

i am using the below code in my sysin

OCCURS FROM(INFILE) LIST(OUFILE) NOHEADER ON(27,2,CH) ON(VALCNT)

please give us a soln.

Regards,
Anand
Back to top
View user's profile Send private message
anandkumarrn

New User


Joined: 06 Feb 2009
Posts: 23
Location: India

PostPosted: Thu Apr 09, 2009 12:09 am
Reply with quote

anandkumarrn wrote:
Hi CICS Guy,

Thanks for your timely help,

But i am facing a problem, the output count is not equal to the input records,
say i have a input file with 111964 and in output it gives 111979 records.
so there is a mismatch between these two counts

i am using the below code in my sysin

OCCURS FROM(INFILE) LIST(OUFILE) NOHEADER ON(27,2,CH) ON(VALCNT)

please give us a soln.

Regards,
Anand



I missed to mention
i am using a input file which is Variable format.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 09, 2009 12:25 am
Reply with quote

With the NOHEADER, I wonder where the 15 extra lines come from.
Have you looked at the first portion and the last portion of the output?
Back to top
View user's profile Send private message
anandkumarrn

New User


Joined: 06 Feb 2009
Posts: 23
Location: India

PostPosted: Thu Apr 09, 2009 12:37 am
Reply with quote

CICS Guy wrote:
With the NOHEADER, I wonder where the 15 extra lines come from.
Have you looked at the first portion and the last portion of the output?


yes, based on that only i identified the count value
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Apr 09, 2009 12:40 am
Reply with quote

anandkumarrn wrote:
yes, based on that only i identified the count value
I don't quite understand.....
What does the sort message look like, could you post it here?
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: Thu Apr 09, 2009 4:09 am
Reply with quote

Anand,

It's not clear what you mean by the "output count". The count of records in the LIST data set would NOT match the count of input records unless you had NO duplicates. You only get one line per duplicate, so if you had two records with the same key, the input count would be 2, but the output count would be 1.

The sum of the ON(VALCNT) occurrences would equal the number of input records.

Since you said your records are VB, I assume your use of 27 for the starting position includes the RDW in positions 1-4. If not, you need to use 31 as the starting position, but the counts would add up either way.

For example, if I have these input records in INFILE (rrrr for the RDW):

Code:

rrrr001                   11 KAJDKASD
rrrr002                   11 DLKSLDAKAS
rrrr005                   11 SDASLKDL
rrrr003                   11 JSDKJFKSDJ
rrrr004                   02 LKDLAS
rrrr006                   02 LDKASLDK
rrrr008                   13 DJKSDKSD


and I use your OCCURS operator, I get this output in OUFILE:

Code:

02                     000000000000002     
11                     000000000000004     
13                     000000000000001     


The input count is 7, but the count of records in the LIST data set is 3. However, the total of the VALCNT counts is 7.

If I look in TOOLMSG, I see this message which tells me the total number of input records processed is also 7.

Code:

ICE628I 0 RECORD COUNT:  000000000000007     


So the total of the VALCNT counts matches the input record count.
The count of records in the LIST data set does not match the input record count, but that's expected since there are duplicate records.

Are you saying that the value in ICE628I that does not match the total of the VALCNT values, or are you saying that the value in ICE628I does not match the actual number of input records, or what?

If you really think there's a mismatch, show the //TOOLMSG and //DFSMSG messages and indicate what you think the mismatched counts are.
Back to top
View user's profile Send private message
anandkumarrn

New User


Joined: 06 Feb 2009
Posts: 23
Location: India

PostPosted: Tue Apr 14, 2009 1:18 pm
Reply with quote

Hi Frank,
i would say my VALCNT and the input records doesn't match,
that is my input records say 1,00,000(1 lakh) and my output count(VALCNT) shows 1,00,015(1 lakh 15 records). so there is a mismatch between the input and the output VALCNT, i am getting this type of error if i have large number of records, i am getting exact count if i have less number of records in my input file.
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: Tue Apr 14, 2009 8:47 pm
Reply with quote

I can't help you without knowing exactly what you're doing. I don't know what your JCL looks like (for all I know, you could be using concatenation with referback and losing records due to a system restriction on doing that) or what messages you're getting.

I need to see the JES, //TOOLMSG and //DFSMSG output for the job you think has the mismatch. You can send it to me offline (yaeger@us.ibm.com) preferably as an attached text file.
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top