How can you find the 2nd Highest salary in a file department wise in abinitio?

Answer Posted / raje0303

Hi Murali,

This logic is correct only will fail when highest salary entries are more than one (e.g. two people has highest and equal salary )
we need to updated scan function as below -

type temporary_type=record
integer(4) temp1;
integer(4) last_sal;
end;

temp :: initialize(in) =
begin
temp.temp1::0;
temp.last_sal::0;
end;



out :: scan(temp, in) =
begin
if(last_sal != in.salary)
begin
out.temp1 :: temp.temp1 + 1;
end;
last_sal = in.salay;
end

out :: finalize(temp, in) =
begin
out.sal:: in.sal;
out.dno :: in.dno;
out.temp1 :: temp.temp1;
end;
out :: output_select(out) =
begin
out::out.temp1 == 2;
end;
###############################################
4.Output_file

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

State the working process of decimal_strip function?

1571


What you can store, manage and reuse centrally in ab initio enterprise meta>environment (eme)?

729


how will i can implement Insert a new record (if not present in Input file),Update the record (if present in input) a csv file in Abinitio

1333


What is a data processing cycle and what is its significance?

664


I installed AbInito in my PC.In components there is no "select" component.How can i get that component?and How we can create user defined components?

1619






How to process records in batches like 1-20 records in first execution and 21-40 records in second run.. so on

480


What is conduct>it?

640


How can you export a component’s internal parameters ?

1934


what is the difference between usersandbox,privatesandbox,publicsandbox,commonproject sandbox?

3389


What dedup-component and replicate component does?

742


Give one reason when you need to consider multiple data processing?

636


What do you mean by the term data warehousing? Is it different from data mining?

684


What are the steps to create a repository in ab initio?

759


What is the ab initio business rules environment (bre)?

691


How can I run the 2 gui merge files?

704