Skip to Content

How to get number of rows count from file using BODS without loading the data.

Hi All,

I have created this document to show you how to get the no of rows count from file without loading it into table.

I have used BODS EXEC command to get the rows count in file.

My BODS is installed on Linux server.


Suppose I have file with name contract_master.csv .

In this file there are 10 columns and 100 rows.

Now if I want to get the count of rows in file then I have to write the following code in script:

$row_count = exec(‘/bin/sh’,’-c “wc -l /C:/Incoming_Files/contract_master.csv’,0);


where row_count is the global variable of type varchar.

C:/Incoming_Files is path where file is kept.

Now when you run the job you will get the following output.

100 /C:/Incoming_Files/contract_master.csv

here first 100 represent total number of rows in file.

Now to remove the file path & file name use following code

$actual_count =  rtrim_blanks( ltrim_blanks( replace_substr(‘/C:/Incoming_Files/contract_master.csv’,”)));

I hope this will help you.

You can do testing vary easily using this functionality,let’s say you have 100 file in your project and you have to load all the files & post loading to varify the count whether all data loaded properly you can apply logic mentioned above.

Feel free to ask any doubt.



You must be Logged on to comment or reply to a post.