AbInitio String Functions PDF
AbInitio String Functions PDF
AbInitio String Functions PDF
Version 1.0
Ponmani Srinivasan([email protected])
1
TATA Consultancy Services AbInitio String Functions 24-Feb-2014
Contents
Document Version Control ............................................................................................................................ 3
1. INTRODUCTION: .................................................................................................................................. 4
2. STRING FUNCTIONS IN ABINITIO: ..................................................................................................... 5
3. EXPLANATION: ..................................................................................................................................... 6
4. APPENDIX ........................................................................................................................................... 12
2
TATA Consultancy Services AbInitio String Functions 24-Feb-2014
3
TATA Consultancy Services AbInitio String Functions 24-Feb-2014
1. INTRODUCTION:
The Ab Initio software is a Business Intelligence platform containing six data processing products:
• Co>Operating System,
• The Component Library,
• Graphical Development Environment,
• Enterprise Meta>Environment,
• Data Profiler
• Conduct>It.
It is a powerful graphical user interface-based parallel processing tool for ETL data management and
analysis. Graphical Development Environment provides an intuitive graphical interface for editing and
executing applications. The strength of Ab Initio-ETL is massively parallel processing which gives it
capability of handling large volume of data.
4
TATA Consultancy Services AbInitio String Functions 24-Feb-2014
There are numerous string function in abinitio:Listed below are the few of them and their
extensive use in various realtime scenarios.
• String_length
• String_filter
• String_lrtrim
• String_index
• String_rindex
• String_substring
• String_replace
• String_filter_out
• Re_get_match
• Re_replace
• Re-split
• String_like
• String_repad
• String_join
• String_lpad
• String_prefix
• String_suffix
• String_is_alphabetic
• String_is_numeric
• Re_get_range_matches
5
TATA Consultancy Services AbInitio String Functions 24-Feb-2014
3. EXPLANATION:
Output:2
Input:Jack K Frencho”
Function Used:
begin
let string("")field_name=string_lrtrim(in.field_name);
let integer("")end_of_first_name=string_index(field_name," ");
let integer("")beginning_of_last_name=string_rindex(field_name," ");
out.last_name::string_substring(field_name,beginning_of_last_name+1,length_of(field_name));
out.first_name::string_substring(field_name,1,end_of_first_name-1);
out.mid_name::string_substring(field_name,end_of_first_name+1,(length_of(field_name)
- (end_of_first_name+beginning_of_last_name)));
end
Output:FirstName:Jack
MidName:K
LastName:Frencho
Function Used:
City:string_replace((string_substring(CLEVELAND, OH ,44113,1,(string_index(CLEVELAND, OH
,44113,",")))),","," ")
6
TATA Consultancy Services AbInitio String Functions 24-Feb-2014
State:string_filter_out(string_replace((string_substring(CLEVELAND, OH
,44113,(string_index(CLEVELAND, OH ,44113,",")),20)),","," "),"0123456789")
Output:
City:CLEVELAND
State:OH
ZipCode:44113
Explanation: To split the Input string into three substrings-City,State and ZipCode separately
and to fetch only first 5 digits for ZipCode
3.4.Objective:To get the index of the first character of a substring of a string that matches a specified
regular expression.
Function Used: re_index("FBO Hines 333 West Wacker Drive 456 LP", "[0-9]+")
Output:10
Explanation:This function will return the index of first occurrence of numeric value
3.5.Objective:To get the first substring in a string that matches a regular expression.
Function Used:re_get_match("FBO Hines 333 West Wacker Drive 456 LP", "[0-9]+")
Output:333
Explanation:This function will return the first substring which matches the numeric pattern [0-9]
3.6.Objective: To replace all substrings in a string that match a specified regular expression.
Function Used: re_replace("2800 Post Oak Boulevard, 30th street Suite 5000", "[0-9]+", "[No &]")
7
TATA Consultancy Services AbInitio String Functions 24-Feb-2014
Explanation:This function replaces numeric substrings of the string with the string "No &", where the
matched substrings replace the ampersand character
3.7.Objective:To split a string into vector substring using a specified regular expression.
Output:
[vector
"CLEVELAND",
"OH",
"44113"]
3.8.Objective:To Compare the contents of two strings,and return a string containing characters that
appear in both of them.
Input:”CLEVELAND, OH 44113”
Output:44113
3.9.Objective:To compare two Input strings and returns characters that appear in one string but not in
the other.
Input:”CLEVELAND, OH 44113”
Output:CLEVELAND,OH
8
TATA Consultancy Services AbInitio String Functions 24-Feb-2014
Input:”CLEVELAND,OH 44113”
Output:0
String_like((”CLEVELAND,OH 44113”,”CLEVELAND%)
Output:1
3.11.Objective: To return a string of a specified length trimmed of any leading and trailing blank
characters, and then right-padded with a given character.
Explanation:This function right-pads the string "702 W. HAMILTON ST " with “REET”, returning a string
of length 21
Input:”CLEVELAND”,”OH”,”44113”
Output:CLEVELAND,OH,44113
Explanation:This function left-pads the string "702 W. HAMILTON STREET " with “No”, returning a
string of length 23
3.14.Objective:To Return a substring that starts at the beginning of the string till a specified length.
Output: 50PUBLICSQUARE
3.15.Objective:To Return a substring of a specified length that ends at the end of the string
Output:1
Scenario:To check for the occurrence of numeric value to mark the start of address
Output:1
3.18.Objective: To return a vector that describes the index and length of a string that matches a
specified regular expression
Input:”CLEVELAND,OH,43114”
Scenario:To count the length of numeric value(ZipCode).To check if Zipcode is of five digits.
This function will return 5
Output: [vector
[record
index 14
length 5]
11
TATA Consultancy Services AbInitio String Functions 24-Feb-2014
4. APPENDIX
On Web:
• - -
• - -
• - - - -
Cached
12
TATA Consultancy Services AbInitio String Functions 24-Feb-2014
13