Anda di halaman 1dari 36

Welcome to Ab Initio

10/15/08

Dell Confidential

Ab Initio

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) Example:

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

10/15/08

Dell Confidential

x is An expression to test.

6

Information Technology

is_failure()

Tests whether an expression is NULL. Syntax:

is_failure (x) Example:

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

10/15/08

Dell Confidential

x is An expression to test.

7

Information Technology

is_null()

Tests whether an expression is NULL. Syntax:

is_null (x) Example:

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

10/15/08

Dell Confidential

x is An expression to test.

8

Information Technology

is_valid()

Tests whether a value is valid. Syntax:

is_valid (x)

Example:

is_valid (123.456) => 1 is_valid ((date(”YYYYMMDD”)) ”abcdefgh”) => 0

x is the value to test.

10/15/08

Dell Confidential

9

Information Technology

length_of()

Returns the length of a value.

Syntax:

length_of ( object ) Example:

length_of (“10001”) => 5 length_of (“abcdefghi”) => 9

10/15/08

Dell Confidential

object is a value.

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

First Method:

How to create User Defined Functions

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:

10/15/08

Dell Confidential

16

Information Technology

How to create User Defined Functions

First Method:

10/15/08

Dell Confidential

17

Information Technology

How to create User Defined Functions

First Method:

10/15/08

Dell Confidential

18

Information Technology

How to create User Defined Functions

First Method:

10/15/08

Dell Confidential

19

Information Technology

How to create User Defined Functions

First Method:

10/15/08

Dell Confidential

20

Information Technology

How to create User Defined Functions

First Method:

10/15/08

Dell Confidential

21

Information Technology

How to create User Defined Functions

First Method:

10/15/08

Dell Confidential

22

Information Technology

How to create User Defined Functions

First Method:

10/15/08

Dell Confidential

23

Information Technology

How to create User Defined Functions

First Method:

10/15/08

Dell Confidential

24

Information Technology

How to create User Defined Functions

First Method:

10/15/08

Dell Confidential

25

Information Technology

Second Method:

How to create User Defined Functions

/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

/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

/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

Input File:

How to convert Decimal to Integer

Required Output File:

 sl_no cal 1 124.6789 2 124.089 3 124.5 4 124.345 5 124.12

10/15/08

Dell Confidential

 sl_no cal 1 125 2 124 3 125 4 124 5 124

DML:

record string(",") sl_no; string(",") cal; string("\n") newline; end;

33

Information Technology

Ceiling.

10/15/08

Dell Confidential

How to convert Decimal to Integer

Required Output File:

How to convert Decimal to

Integer sl_no

cal

1 125

2 124

3 125

4 124

5 124

34

Information Technology

References

Ab Initio Software Discussion Forums www.ittoolbox.com

10/15/08

Dell Confidential

35

Information Technology

?

?

?

?

?

10/15/08

Dell Confidential

?

?

?

Q&A

?

?

?

?

?

?

?

?

?

?

? ?

?

36

Information Technology