Count number records from input file

Formally known as "Mercator Inside Integrator 6.7", DataStage TX enables high-volume, complex transactions without the need for additional coding.

Moderators: chulett, rschirm

Post Reply
dstx_1
Participant
Posts: 4
Joined: Sun Dec 31, 2006 3:41 pm

Count number records from input file

Post by dstx_1 »

Hello everyone,
I need help to count number of records from my source file and write it to the output.. The format of my source file is as follow:

I have multiple record types in my file. RecordTypes 2,3 & 4 are under a Loop . For instance

RecordType1 (1:1)
Loop(1:9999)
RecordType2 (1:1)
RecordType3 (1:1)
RecordType4 (1:9999)

I need to be able to get a count all the recordType3 + recordType4. I have tried using Count function but haven't been able to get the desired results. Not sure how I can get a total count of RecordType4 that occurs multiple times in the Loop.

Thanks for all your help in advance...



Thanks
janhess
Participant
Posts: 201
Joined: Thu Sep 18, 2003 2:18 am
Location: UK

Post by janhess »

How did you specify your COUNT rule? It looks as though a simple COUNT would work but it needs to be done against the file object ie file input card.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Have you solved your own query? If so, do mind sharing it for the further searchers.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
dstx_1
Participant
Posts: 4
Joined: Sun Dec 31, 2006 3:41 pm

Post by dstx_1 »

I was able to use the count function as follow:

SUM(COUNT(RecordType3 Loop:File) + COUNT(RecordType4:Loop:File))

and I was able to get the desired results..


Thanks!
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Thanks for sharing this.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply