Hello,
I want to calculate the number of rows in a sequential file by using the Count rows option in the aggregator stage.
Unfortunately, I get no rowcount when the sequential file is empty.
Any idea how to solve this?
Peter
count rows in a sequential file
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Execute Command activity in job sequence to dir the file and get the size from that, on the basis of which you can decide to execute the job or not.
Clearly, if DataStage processes 0 rows, there's nothing there to count.
Clearly, if DataStage processes 0 rows, there's nothing there to count.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
You can use an 'External Source' stage. give the command to be executed as 'wc -l'. this returns the value as an integer. output will be a single column, single row (count). this sometimes might return two rows of same data. just change the spaces before and after '-' and try. it is only one space but not sure if it is before or after the '-'. Not sure about Aggregator stage though. this is not exactly wat you wanted but just another way of getting the source count. hope it helps.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hello,
This one works for my situation:
- Use Sybase OC stage to create a single row (SELECT 1)
- Use the Link Collector stage to append the source rows of the sequential file with this extra row.
- Use the Aggregator stage to count the number of rows
- Subtract one of this count to get the number of rows in the sequential file.
Peter
This one works for my situation:
- Use Sybase OC stage to create a single row (SELECT 1)
- Use the Link Collector stage to append the source rows of the sequential file with this extra row.
- Use the Aggregator stage to count the number of rows
- Subtract one of this count to get the number of rows in the sequential file.
Peter
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 1
- Joined: Tue Dec 25, 2012 8:18 pm