You are on page 1of 36

Ab Initio

Welcome to
Ab Initio

10/15/08
Dell Confidential

WELCOME
TO

1
Information Technology

Points on Board
Ab Initio Functions
User-Defined Functions
Conversion of Decimal to Integer
Questions

10/15/08
Dell Confidential

2
Information Technology

Ab Initio Functions

Built-in Functions
Date Functions
Inquiry and Error Functions
Lookup Functions
Math Functions
Miscellaneous Functions
String Functions
User-Defined Functions

10/15/08
Dell Confidential

3
Information Technology

Built-in Functions

Inquiry and Error Functions


1) force_error()
2) is_defined()
3) is_failure()
4) is_null()
5) is_valid()
6) length_of()
7) size_of()
8) write_to_log
9) write_to_log_file

10/15/08
Dell Confidential

4
Information Technology

force_error()

Causes an error and returns a specified error message.


Syntax:
force_error (string message)
Example:
force_error (PK violation) => error
The error message is written to the error port of the containing
component. Execution of graph is stopped

10/15/08
Dell Confidential

5
Information Technology

is_defined()

Tests whether an expression is not NULL.


Syntax:
is_defined (x)

x is An expression to test.

Example:
is_defined (123) => 1
is_defined (NULL) => 0

10/15/08
Dell Confidential

6
Information Technology

is_failure()

Tests whether an expression is NULL.


Syntax:
is_failure (x)

x is An expression to test.

Example:
is_failure (123) => 0
is_failure (NULL) => 1

10/15/08
Dell Confidential

7
Information Technology

is_null()

Tests whether an expression is NULL.


Syntax:
is_null (x)

x is An expression to test.

Example:
is_null (123) => 0
is_null (NULL) => 1

10/15/08
Dell Confidential

8
Information Technology

is_valid()

Tests whether a value is valid.


Syntax:
is_valid (x)

x is the value to test.

Example:
is_valid (123.456) => 1
is_valid ((date(YYYYMMDD)) abcdefgh) => 0

10/15/08
Dell Confidential

9
Information Technology

length_of()

Returns the length of a value.


Syntax:
length_of ( object )

object is a value.

Example:
length_of (10001) => 5
length_of (abcdefghi) => 9

10/15/08
Dell Confidential

10
Information Technology

size_of()

Returns the size of the value in bytes, including delimiter


characters.
Syntax:
size_of ( value )
Example:
size_of (10001) => 6
size_of (abcdefghi) => 10
size_of (42.56) =>8
10/15/08
Dell Confidential

11
Information Technology

write_to_log()

Writes text to the log port of a component.


Syntax:
write_to_log ( string event_type, string event_text )
event_type --> A type of event
event_text --> Text to accompany event_type

10/15/08
Dell Confidential

12
Information Technology

write_to_log_file()

Writes a message to a log file.


Syntax:
write_to_log_file ( string filename, string text )
filename --> The URL of a log file
text --> Text to write to filename
Details
This function opens the file, appends the message text to the file, and
closes the file on every call.
10/15/08
Dell Confidential

13
Information Technology

How to create User Defined Functions

First Method:
Example: Multiplication of two numbers.

10/15/08
Dell Confidential

14
Information Technology

How to create User Defined Functions

Writes a message to a log file.


Syntax:
write_to_log_file ( string filename, string text )
filename --> The URL of a log file
text --> Text to write to filename
Details
This function opens the file, appends the message text to the file, and
closes the file on every call.
10/15/08
Dell Confidential

15
Information Technology

How to create User Defined Functions

First Method:
Addition of two numbers.

10/15/08
Dell Confidential

16
Information Technology

How to create User Defined Functions

First Method:
Addition of two numbers.

10/15/08
Dell Confidential

17
Information Technology

How to create User Defined Functions

First Method:
Addition of two numbers.

10/15/08
Dell Confidential

18
Information Technology

How to create User Defined Functions

First Method:
Addition of two numbers.

10/15/08
Dell Confidential

19
Information Technology

How to create User Defined Functions

First Method:
Addition of two numbers.

10/15/08
Dell Confidential

20
Information Technology

How to create User Defined Functions

First Method:
Addition of two numbers.

10/15/08
Dell Confidential

21
Information Technology

How to create User Defined Functions

First Method:
Addition of two numbers.

10/15/08
Dell Confidential

22
Information Technology

How to create User Defined Functions

First Method:
Addition of two numbers.

10/15/08
Dell Confidential

23
Information Technology

How to create User Defined Functions

First Method:
Addition of two numbers.

10/15/08
Dell Confidential

24
Information Technology

How to create User Defined Functions

First Method:
Addition of two numbers.

10/15/08
Dell Confidential

25
Information Technology

How to create User Defined Functions

Second Method:
Example: Addition of two numbers.
/usr/dell/us_svc/practise/xfr/functions.xfr
out ::AddTwoNumbers(num1, num2 ) =
begin
out :: num1 + num2 ;
end ;

10/15/08
Dell Confidential

26
Information Technology

How to create User Defined Functions

Writes a message to a log file.


Syntax:
write_to_log_file ( string filename, string text )
filename --> The URL of a log file
text --> Text to write to filename
Details
This function opens the file, appends the message text to the file, and
closes the file on every call.
10/15/08
Dell Confidential

27
Information Technology

How to create User Defined Functions

Writes a message to a log file.


Syntax:
write_to_log_file ( string filename, string text )
filename --> The URL of a log file
text --> Text to write to filename
Details
This function opens the file, appends the message text to the file, and
closes the file on every call.
10/15/08
Dell Confidential

28
Information Technology

How to create User Defined Functions

Writes a message to a log file.


Syntax:
write_to_log_file ( string filename, string text )
filename --> The URL of a log file
text --> Text to write to filename
Details
This function opens the file, appends the message text to the file, and
closes the file on every call.
10/15/08
Dell Confidential

29
Information Technology

How to create User Defined Functions

Writes a message to a log file.


Syntax:
write_to_log_file ( string filename, string text )
filename --> The URL of a log file
text --> Text to write to filename
Details
This function opens the file, appends the message text to the file, and
closes the file on every call.
10/15/08
Dell Confidential

30
Information Technology

How to use User Defined Functions

Addition of two numbers.


/usr/dell/us_svc/practise/xfr/functions.xfr
out ::AddTwoNumbers(num1, num2 ) =
begin
out :: num1 + num2 ;
end ;

10/15/08
Dell Confidential

31
Information Technology

How to use User Defined Functions

Addition of two numbers.


/usr/dell/us_svc/practise/xfr/functions.xfr
out ::AddTwoNumbers(num1, num2 ) =
begin
out :: num1 + num2 ;
end ;

10/15/08
Dell Confidential

32
Information Technology

How to convert Decimal to Integer


Input File:

Required Output File:

sl_no
1
2
3
4
5

sl_no
1
2
3
4
5

cal
124.6789
124.089
124.5
124.345
124.12

cal
125
124
125
124
124

DML:
record
string(",") sl_no;
string(",") cal;
string("\n") newline;
end;
10/15/08
Dell Confidential

33
Information Technology

How to convert Decimal to Integer

Ceiling.

Required Output File:


How to convert Decimal to
Integer
sl_no cal
1
125
2
124
3
125
4
124
5
124
10/15/08
Dell Confidential

34
Information Technology

References

Ab Initio Software
Discussion Forums
www.ittoolbox.com

10/15/08
Dell Confidential

35
Information Technology

Q&A

?
10/15/08
Dell Confidential

?
?

?
?

?
?

?
36
Information Technology

You might also like