Monday, 7 June 2021

Ab initio and Unix Questions 2021 -

1 ) Reverse a string in Abinitio and Unix? 

Example - abinitio to oitiniab 

 Abinitio - Use Reformat and in Transformation use below logic - out.field1::in.field1[::-1] 

 Unix - echo abinitio | rev 

 2) Assign Default value as NULL to vector field?

 DML - 
 Record 
string(|) name; 
decimal(|) array_size; 
record string(|) code; 
end[array_size] code subrec; 
end

 let's say want to assign a null value to the code field? 

 use allocate_to_nulls(); 

 3) i/p - a b c d o/p- ab bc cd how to achieve this scenario?

 hint - Rollup with null key, concatenate all records, we will get abcd next use normalize ,keep length as string_length(in.col) -1; use substring to get the records.

 4) Unix script that will read table name from a txt file and give the record count with the table name, we have to use m_db command the output should look like below 

 o/p- 
 Tablename|Record Count
 table1|10
 table2|15 
 table3|200

Note - create a simple txt file which will contain Tables name, create Unix script which will read the table name from the txt file, and use m_db unload dbcfile.dbc -select 'select count(*) from tablename' to get the record count.

5) Assign a sequence number to multifile ?
Note - (next_in_sequence() -1)*no_of_partitions() + this_partition() +1



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 ...