Page 1 of 1

Number of records

Posted: Thu Dec 18, 2008 1:55 am
by veera24
Hi all,
i need to find the number of records in a file. Meanwhile i shouldn't include 1st record and as well as last record. Consider 10 number of records contribute to 1 Block in a file.
Here, i need to calculate the total number of records and should divide the resultant by 10 (as Block has 10 records). If the resultant value is 5.9 then i should write the value as 6, if it 5.5 then also 6 and even if it is 5.1 then output should 6. Similarly, if the value is 7.1 then the output should be 8.
If we use the ROUND OFF function then 5.1 or 7.1 or 5.4 or 2.3 etc etc.. will be rounded off to their preceding whole number. So could any one suggest me a way to try this?hope you would got what am trying to say.

In short,
If a number has a deci mal value then it should be converted into their successive whole number (regardless of the Mathematics logic)


Your time will be highly appreciated.

Thanks in advance,
Veera

Re: Number of records

Posted: Thu Dec 18, 2008 2:02 am
by kamalshil
do u have to calculate records from dataset? or its in other format.

Posted: Thu Dec 18, 2008 2:15 am
by balajisr
Use Function Ceil.

Re: Number of records

Posted: Thu Dec 18, 2008 2:16 am
by veera24
kamalshil wrote:do u have to calculate records from dataset? or its in other format.
My input will be a mainframe file and i need to calculate the number of records based on the block size

Posted: Thu Dec 18, 2008 2:17 am
by veera24
balajisr wrote:Use Function Ceil.
I haven't used that function. Could you pls elaborate the same and how to implement?

Posted: Thu Dec 18, 2008 2:47 am
by balajisr
It seems Ceil() exists only in help.

Try this.

Code: Select all

OConv(Col1+.5,"MD0")

Posted: Thu Dec 18, 2008 5:10 am
by ray.wurlod
Ceil() is for parallel jobs only.

Do you need this count before the job runs, or as a result from the DataStage job?

In the first case get the result of wc -l pathname and subtract 2.
In the second case get the last value of @INROWNUM and subtract 2. The Aggregator stage can give a Last value.

Posted: Thu Dec 18, 2008 11:51 pm
by veera24
ray.wurlod wrote:Ceil() is for parallel jobs only.

Do you need this count before the job runs, or as a result from the DataStage job?

In the first case get the result of wc -l pathname and subtract ...
Ray,
I couldn't see your content as am not a member. So could you reply back without that?Your help will be appreciated.Hope you would do.

Thanks,
Veera