Describe OConv () and IConv () Functions in DataStage?

0
46
OConv () and IConv () Functions
OConv () and IConv () Functions

What is OConv () and IConv () functions and where are they used? DataStage Tutorial will explain both the functions here with the help of the experts from Tutorial Chat!

OConv () and IConv () Functions – A Brief Overview

OConv () Function

Use the OCONV function to convert string to a specified format for external output. The result is always a string expression.

String is converted to the external output format specified by conversion.

Conversion must evaluate to one or more conversion codes separated by value marks (ASCII 253).

If multiple codes are used, they are applied from left to right as follows: the leftmost conversion code is applied to string, the next conversion code to the right is then applied to the result of the first conversion, and so on.

The string evaluates to the null value, null is returned. If conversion evaluates to the null value, the OCONV function fails and the program terminates with a run-time error message.

The OCONV function also allows PICK flavor exit codes.

The STATUS function reflects the result of the conversion:

0 – The conversion is successful.

1 – An invalid string is passed to the OCONV function; the original string is returned as the value of the conversion. If the invalid string is the null value, null is returned.

2 – The conversion code is invalid.

3 – Successful conversion of possibly invalid data

For information about converting strings to an internal format, stay tuned with DataStage Tutorials!

IConv () Function

Use the ICONV function to convert string to a specified internal storage format. string an expression that evaluates to the string to be converted.

Conversion is an expression that evaluates to one or more valid conversion codes, separated by value marks (ASCII 253).

String is converted to the internal format specified by conversion. If multiple codes used, they are applied from left to right. The first conversion code converts the value of string. The second conversion code converts the output of the first conversion, and so on.

If string evaluates to the null value, null returned. If conversion evaluates to the null value, the ICONV function fails and the program terminates with a run-time error message.

The STATUS function reflects the result of the conversion:

0 – The conversion is successful.

1 – String is invalid. An empty string is returned, unless string the null value, in which case null returned.

2 – Conversion is invalid.

3 – Successful conversion of possibly invalid data

For information about converting strings to an external format, stay tuned for DataStage Tutorials!

The following are examples of date conversions for OConv () and IConv () Functions

Source Line

Converted Value

DATE=ICONV(“02-23-85″,”D”)

6264

DATE=ICONV(“30/9/67″,”DE”)

-92

DATE=ICONV(“6-10-85″,”D”)

6371

DATE=ICONV(“19850625″,”D”)

6386

DATE=ICONV(“85161″,”D”)

6371

Click the Below Links to Know More,

Subscribe Tutorial Chat to know more about DataStage Components!