Finding number of rows in a seq file()
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 106
- Joined: Thu Jun 08, 2006 8:51 am
Finding number of rows in a seq file()
Hi All,
The job has an Inbound Sequential File connected to a Transformer. It needs to find the number of records in the file. If the file is empty i.e the number of rows is 0, I am not able to fetch the count and use for other validations.
Thanking you in advance
Vc
The job has an Inbound Sequential File connected to a Transformer. It needs to find the number of records in the file. If the file is empty i.e the number of rows is 0, I am not able to fetch the count and use for other validations.
Thanking you in advance
Vc
-
- Participant
- Posts: 106
- Joined: Thu Jun 08, 2006 8:51 am
-
- Participant
- Posts: 15
- Joined: Tue Nov 21, 2006 3:45 am
- Location: WhiteField, Bangalore
If the file is empty, then no rows were passed down the link. Is that right?
If you are using DSGetLinkInfo then you should get the row count i.e, DSJ.LINKROWCOUNT as 0
When you say you are not able to fetch the row count, do you get some errors/warning?
If you are using DSGetLinkInfo then you should get the row count i.e, DSJ.LINKROWCOUNT as 0
When you say you are not able to fetch the row count, do you get some errors/warning?
Narasimha Kade
Finding answers is simple, all you need to do is come up with the correct questions.
Finding answers is simple, all you need to do is come up with the correct questions.
Well, yes if you are trying to get the row count inside the transformer and if no rows come thorough it wont be instantiated and hence you wont get any validations done.
You need to handle this is before/after stage subroutine. Maybe test to see if file size is zero then do something.
You need to handle this is before/after stage subroutine. Maybe test to see if file size is zero then do something.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Right.DSguru2B wrote:You need to handle this is before/after stage subroutine.
If we are using the routine as an After-job subroutine, I guess we can skip the test to check if the file is of zero size, before we can get the DSGetLinkInfo?
If no rows have passed through the link, we get the result as zero.
Narasimha Kade
Finding answers is simple, all you need to do is come up with the correct questions.
Finding answers is simple, all you need to do is come up with the correct questions.
Not really. Like the OP said, that he is doing some validations and getting rowcounts. Neither of those can be executed within the transformer without sending in a row. Thats why a file size check is necessary before the transformer gets executed (thats why a before stage routine and not a before job routine). The sub-routine will check if the size is 0 and will send out a zero thus sending something or doing something. That something can be whatever the OP wants.narasimha wrote:If we are using the routine as an After-job subroutine, I guess we can skip the test to check if the file is of zero size, before we can get the DSGetLinkInfo?
If no rows have passed through the link, we get the result as zero.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.