DataStage Number Functions

Introduction

In this guide, we will explore the various number functions available in DataStage and learn how to use them effectively.

Basic Arithmetic Operations

Addition

number1 + number2

This code adds two numbers together. For example:

5 + 3

This would return the result 8.

Subtraction

number1 - number2

This code subtracts one number from another. For example:

5 - 3

This would return the result 2.

Multiplication

number1 * number2

This code multiplies two numbers together. For example:

5 * 3

This would return the result 15.

Division

number1 / number2

This code divides one number by another. For example:

5 / 3

This would return the result 1.6666666666667.

Modulus Operation (Remainder)

number1 % number2

This code calculates the remainder of dividing one number by another. For example:

7 % 3

This would return the result 1.

Absolute Value

ABS(number)

This code returns the absolute value of a number. For example:

ABS(-5)

This would return the result 5.

Rounding Operations

Ceiling (Round up to nearest integer)

CEILING(number)

This code rounds a number up to the nearest integer. For example:

CEILING(5.2)

This would return the result 6.

Floor (Round down to nearest integer)

FLOOR(number)

This code rounds a number down to the nearest integer. For example:

FLOOR(5.2)

This would return the result 5.

Conversion Functions

To Double Precision (TO_DOUBLE)

TO_DOUBLE(number)

This code converts a numeric value to a double precision floating-point number. For example:

TO_DOUBLE(123)

This would return the result 123.0.

To Integer (INT)

INT(number)

This code converts a numeric value to an integer. For example:

INT(123.456)

This would return the result 123.