Abinitio Interview Question 35

 

Abinitio Interview Question 35



Input:

Col1|Col2

A   | A

A   | B

B   | C

B   | D

B   | E


Output:

Col1,Col2, Seq1,Seq2

A,  A, 1, 1.1

A,  B, 1, 1.2

B,  C, 2, 2.1

B,  D, 2, 2.2

B,  E, 2, 2.3



INPUT--> Replicate -->  ROLLUP on Col1--->assign seq no=Seq1 ----->A,1

   B,2 

|                 

| Inner

|                 JOIN  -->  SCAN -->OUTPUT 

             |

|

|----------------------------------------------------->


SCAN


type temporary_type

record

string("") sub_seq;

decimal("") cnt;

end;


out::initiaize(in)=

begin

out.sub_seq='';

out.cnt=1


end;


out::scan(temp,in)=

begin


out.sub_seq::string_concat(in.Seq1,".",(string(""))temp.cnt);

out.cnt::temp.cnt+1;


end;


out::finalize(temp,in)=

begin

out.Col1::in.Col1;

out.Col2::in.Col2;

out.Seq1::in.Seq1;

out.Seq2::temp.sub_seq;


end;


For More Abinitio, AWS, Database content please visit my youTube channel.

https://www.youtube.com/@datapundit

@datapundit








Comments

Popular posts from this blog

Abinitio Interview Question # 1 - Write Multiple Files in Abinitio

Next In Sequence in ABinitio | How next_in_sequence() works in MFS