Wednesday, 7 July 2021

Abinitio-Unix Scenario Part2 -

 1) How to check if the file size is greater than 10 MB?

find ./ -maxdepth 1 -type f -size +10M

2) How to check active running services related to abinitio?

m_ps | guess 

3) city1 city2 distance

     A          B      100

     B          A      100

     A          C      200

o/p- 

A    B    100

A    C     200

Ans ->  I/p - Rollup - Reformat - sort - dedup - o/p

Rollup - 

sorted input - false

key - city1,city2

Transform - 

 out.city1 :: accumulation(in.city1)

 out.city2 :: accumulation(in.city2)

 out.distance :: in.distance;

Reformat - 

create vector variable source_city assign it to  vector_sort(vector_concat(in.city1.in.city2))

out.city1::source_city[0];

out.city2::source_city[1];

out.distnace::in.distnace;

sort -

 key - city1,city2

dedup - 

key - city1,city2

keep - first 

4)I/P-  

F1   F2

1    (a,b,c,d,e)

2    (a,b,c,d,e)

3    (a,b,c,d,e)

O/P- 

F1    F2

1      a

2      b

3      c

Ans -> I/P -Normalize -O/P

Normalize - 

Length -3

normalize - out.F2 :: string_substring(string_replace(in.F2,",",""),index+2,1)


5) Count the no. of words in below I/P  file ? 

city

 Bangalore

Occurance of "a" is twice.

Ans- > I/P-Redefine-Rollup-O/P

Redefine - 

record

string(1) city;

end

Rollup - Sorted input - False

key - city;

out,city::in.city;

out.count:: count(in.city);


6) Input - 

ID

8

5

9

3

2

What should be the output if we use ID >='2' in select and next_in_sequence in the transformation of Reformat component?

Ans ->

ID Seq

8    1

5    2

9    3

3    4

2    5


What should be the output if we use ID >'2' in select and next_in_sequence in the transformation of Reformat component?

ID Seq

8    1

5    2

9    3

3    4

7) Input 

ID ID1 ID2

A 100 NULL

A NULL 200

B 200 400

B NULL NUll

Output - 

ID  ID2 ID3

A   100  200

B   200  400

Ans->

I/P- Rollup -O/P

Rollup - 

Key - ID

Transform -

out.ID::in.ID;

out.ID1::string_filter_out(concatenation(in.ID1),"NULL")

out.ID2::string_filter_out(concatenation(in.ID2),"NULL")



No comments:

Post a Comment

how to create dml dynamically in Ab-initio

 $[ begin let int i = 0; let string(int) complete_list = "emp_nm,billable,age,designation,location"; let string(int) file_content ...