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
What is abinitio?
How is the partitioning with key different from round robin partition?
Mention what is a partition and what are the different types of partition components in abinitio?
What are differences between different gde versions(1.10,1.11,1.12,1.13and 1.15)?
Have you used rollup component? Describe how.
Explain what is sort component in abinitio?
What is sort component in abinitio?
How transaction file different from that of a sort file?
What is data encoding?
Input Data: AAABBBCC CCAAABB expected output A3B3C2 A3B2C2 How can I achieve this in Ab initio? where In output count of occurrences should be sorted from high to low
What is the purpose of having stored procedures in a data-based?
What is the function that transfers a string into a decimal?
Can anyone give me an exaple of realtime start script in the graph?
How to replace last 4 digits of an input column with XXXX given input column has 12 digits?
What kind of layouts does abinitio support?