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

Explain batch processing in ab initio?

918


What a local lookup is?

603


Hi friends, what are the new features in abinito3.0?

2316


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

861


what is the use of catlog or catlogfile?

1919






What kind of layouts does abinitio support?

631


What are “business rules” in ab initio business rules environment (bre)?

1424


When we should use 'jobid' for commit table (Output table component?? How to use in abinitio graph?

1911


46.How you can create cross joined output using join component ? 47.What is the default layout of watcher files ? How to use in abinitio graph? 48.Why you get 'too many open files' error ? How to use in abinitio graph? 49.What is the significance of vnode folder under AB_WORK_DIR ? How to use in abinitio graph? 50, What is the significance AB_AIR_BRANCH? How to use in abinitio graph? 51. How can you select only unique records from a set of records ? How to use in abinitio graph? 52. How next_in_sequence work in parallel layout ? How to use in abinitio graph? 53. Why you want to set a modest number in limit ? How to use in abinitio graph? 54. How you can encrypt a password and use it in dbc file? How to use in abinitio graph? 55. Which function you should be using if you do not want to process non printable char from a feed file ? How to use in abinitio graph? 56. How you can run a component for certain conditions ? How to use in abinitio graph? 56. What is catalog and when you should use it ? How to use in abinitio graph? 57. How you can use reformat as a router ? How to use in abinitio graph? 58. How many process gets created for a n-way parallel component ? How to use in abinitio graph? 59. Why delimited DMLs take more time to process than fixed length DMLs? How to use in abinitio graph? 60. How can you select only first and last record from a file without using next_in_sequence? How to use in abinitio graph? 61.Why you should always keep largest input as driving input for Join ? How to use in abinitio graph? 62. What a catalog file contains ? How to use in abinitio graph? 63. What Is private project and public project ? How to use in abinitio graph? 64. Why you should not use checkpoint after replicate ? How

5211


When we should use 'jobid' for commit table (Output table component??

7988


What is a deadlock and how it occurs?

669


How co> operating system natively processes the data?

616


What dedup-component and replicate component does?

735


Why creation of temporary files depends on the value of MAX CORE ? How to use in abinitio graph? 10. What is the diff between abinitiorc and .abinitiorc files ? How to use in abinitio graph? 11. What is the use of allocate()? How to use in abinitio graph? 12. What is use of branch in EME ? 13. How you can break a lock in EME ? How can you lock a file so that only no one other than EME admin can break it ? How to use in abinitio graph? 14. When you should be using ablocal() ? How you can use ablocal_expr? How to use in abinitio graph? 15. Why you should not keep the layout as 'default' for input table component ? How to use in abinitio graph? 16. What is dynamic lookup ? How to use in abinitio graph? 17. What is dependent parameter ? How to use in abinitio graph? 18. What is BRE ? (Business Rule Environment - This is a recent addition in abinitio package) How to use in abinitio graph? 19.What is output index ? How to use in abinitio graph? 20. How you can track the records those are not getting selected from ‘select’ in reformat component ? How to use in abinitio graph? 21. Can we have more than one launcher process for a particular graph ? How about agent ? How to use in abinitio graph? 22. There are lot of new fuctions added in 2.15 , you can ask about them ? How to use in abinitio graph? 23. How can you run multiple instances of a graph in parallel? How to use

3553


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

627