Ab Initio Assignments and question bank
1) Suppose I have a scenario like below:
Input:
======
Id Col1 Col2
a 100 Null
a Null 200
b 300 Null
b Null 400
And I need output as:
Output:
=======
Id Col1 Col2
a 100 200
b 300 400
2) I have a scenario like below:
Date Amt
01-01-2016 100
01-01-2016 300
02-01-2016 350
01-01-2016 200
02-01-2016 150
02-01-2016 400
01-01-2016 250
02-01-2016 250
I want to find top to transactions on each date:
3) Input file
Col1 col2
1A
2B
3C
4D
and desired output should be like below:
col1 1 2 3 4
col2 A B C D
4) Can i sort the data using reformat and normalize components in Abinitio, If yes, then how explain
with example ?
Yes we can sort the data using Reformat and normalize.
In Reformat by taking vector_sort we can able to do that.
[Am working on it to analize how it works]
5) How do you pass the parameters of a graph from the backend? Explain with examples.
There are two types for passing the parameters from backend
1. Keyword
air sandbox run graph_name -param1 “value1” -param2 “value2”
2. Positional
air sandbox run graph_name “value1” “value2”
The parameter order is same as defined in the graph
6) I have a file, like :
City1|City2|Distance
ban|hyd|600
hyd|ban|600
ban|mum|300
mum|ban|300
mum|hyd|470
Now my output should have only unique combination of (City1 and City2) and (City2 and City1) .
O/P should be like :
City1|City2|Distance
ban|hyd|600
ban|mum|300
mum|hyd|470
(hyd|ban|600 , mum|ban|300 are considered as duplicates)
Assignment 2
Merchant
Merchant_ID Merchant_name Merchant_Chain Merchant_City Merchant_Country
1668 Kings Co Mc Donalds Paris France
2884 $$Argo Bros. KFC Manchester UK
3846 Fish & Co Burger King Munich Germany
4098 James & Co Argos Luton UK
5994 Coloner, Jack Co. Burger King Frankfurt Germany
6764 Sporty Bros. Mc Donalds Prague CR
7124 Jagger Co Burger King Rome Italy
8989 $$Dominic, Jr Co Argos London UK
9001 Jones Co KFC New York US
Transaction
Transaction ID Merchant ID Transaction_Amount Transaction_Date(YYYYMMDD)
1 1668 6764 20130104
2 3846 5456 20130912
3 6764 46785 20130831
4 5994 666 20131031
5 7124 80988 20130324
6 1668 62445 20130228
7 8989 27974 20131207
8 9001 66789 20130812
9 6764 7795 20130815
10 2884 67894 20130107
11 7124 76665 20130318
12 1668 89704 20130815
13 8989 64433 20130623
14 4098 78990 20130905
15 2884 508975 20130217
16 7124 5992406 20130129
17 5994 587 20130423
18 3846 9879 20130525
19 8989 3998 20130615
20 4098 3448889 20130521
21 9001 72511 20130314
22 5994 3094 20130731
23 5994 5522 20130423
24 8989 5579 20131108
25 3846 579908 20131045
Currency
Country Currency
UK GBP
Italy EUR
CR EUR
France EUR
Greece EUR
US USD
1. Add the Header and Trailer to the transaction file.
Header Format and Values :
String (20) filename Value: Hardcoded -“Merchant Transaction”
Date (“YYYYMMDD”) filedate Value : Hardcoded -“20141005”
Trailer Format and Values :
String (30) Trailer Value : Hardcoded -“File Trailer”
Decimal (05) fileCount Value : total number of transactions in the transaction file
Decimal (10) TransactionSum Value : Sum of all transactions amount in the transaction file
2.
a. There are some malformed characters (“$”, “.”, “,”) in Merchant_name column which are not
acceptable in target. Please pass only string characters to target after removing these malformed
characters.
b. In the above scenario, replace “&” with “and”.
3. Separate out the UK and Germany transactions in two different file. Keep rest of the transactions in third file.
4. Produce Summary of transactions as per different Country in the below format. Use Currency Table as lookup.
Transaction_country Total_Transaction Transaction Currency
Amount
5. Produce Summary of transactions as per different Chains in the below format.
Merchant_Chain Total_Transaction Transaction Currency
Amount
6. Assign Quarter number for every transaction in the transaction file . Layout of the file should be:
Transaction ID Merchant ID Transaction_Amount Transaction_Date(YYYYMMDD) Tnx_quarter
UNIX/ co-op/ EME commands and shell scripting
1) Find out how many times user did check-in activity in last 30 days. When did he do last
check-in.
Last -30 username or air tag ls -user
2) How do I print content of 3rd last version from EME of a dml on my screen on the fly?
Air object versions <project_path> head -3
3) Generate a dml from backend for database table. Explain with example.
m_db gendml $DBdbname.dbc -table_name
4) Find out a largest multifile in AI_MFS directory.
m_ls -lart -S
5) which parameter tells about EME location, Co>Op version etc
EME location : AB_AIR_ROOT
Co>Ops Version : m_env -version or m_env-v
6) There is a file Unix_Test.txt which contains words Unix, how will you replace all Unix to
UNIX?
sed -i s/Unix/UNIX/g Unix_Test.txt
7) Write a shell script to create a menu driven program for adding, deletion or finding a
record in a file. File should have the field like rollno, name, semester and marks of three
subjects. Last option of the menu should be to exit the menu.