You are on page 1of 10

B

Functions
This appendix describes the functions that are available from the expression editor under the Function menu item. You would typically use these functions when defining a column derivation in a Transformer stage. The functions are described by category. This set includes functions that take string arguments or return string values. If you have NLS enabled, the arguments strings or returned strings can be strings or ustrings. The same function is used for either string type. The only exceptions are the functions StringToUstring () and UstringToString ().

Date and Time Functions


The following table lists the functions available in the Date & Time category (Square brackets indicate an argument is optional):
Name
DateFromDaysSince

Description
Returns a date by adding an integer to a baseline date Returns a date from the given julian date Returns the number of days from source date to the given date Returns the hour portion of a time

Arguments
number (int32) [baseline date] juliandate (uint32) source_date given_date time

Output
date

DateFromJulianDay DaysSinceFromDate

date days since (int32)

HoursFromTime

hours (int8)

Parallel Job Developers Guide

B-1

Date and Time Functions

Functions

Name
JulianDayFromDate MicroSecondsFromTime

Description
Returns julian day from the given date Returns the microsecond portion from a time Returns the minute portion from a time Returns the day of the month given the date Returns the month number given the date Returns the date of the specified day of the week soonest after the source date Returns the date of the specified day of the week most recent before the source date Returns the second portion from a time Returns the number of seconds between two timestamps Returns the system time and date as a formatted string Returns the time given the number of seconds since midnight Returns a timestamp form the given date and time Returns the timestamp from the number of seconds from the base timestamp Returns a timestamp from the given unix time_t value Returns a unix time_t value from the given timestamp

Arguments
date time

Output
julian date (int32) microseconds (int32) minutes (int8) day (int8) month number (int8) date

MinutesFromTime MonthDayFromDate MonthFromDate NextWeekdayFromDate

time date date source date day of week (string)

PreviousWeekdayFromDate

source date day of week (string)

date

SecondsFromTime SecondsSinceFromTimestamp

time timestamp base timestamp -

seconds (dfloat) seconds (dfloat)

TimeDate

system time and date (string) time

TimeFromMidnightSeconds

seconds (dfloat)

TimestampFromDateTime

date time seconds (dfloat) [base timestamp]

timestamp

TimestampFromSecondsSince

timestamp

TimestampFromTimet

timet (int32)

timestamp

TimetFromTimestamp

timestamp

timet (int32)

B-2

Parallel Job Developers Guide

Functions

Date and Time Functions

Name
WeekdayFromDate

Description
Returns the day number of the week from the given date. Origin day optionally specifies the day regarded as the first in the week and is Sunday by default Returns the day number in the year from the given date Returns the year from the given date Returns the week number in the year from the given date

Arguments
date [origin day]

Output
day (int8)

YeardayFromDate

date

day (int16)

YearFromDate YearweekFromDate

date date

year (int16) week (int16)

Date, Time, and Timestamp functions that specify dates, times, or timestamps in the argument use strings with specific formats: For a date, the format is %yyyy-%mm-%dd For a time, the format is %hh:%nn:%ss, or, if extended to include microseconds, %hh:%nn:%ss.x where x gives the number of decimal places seconds is given to. For a timestamp the format is %yyyy-%mm-%dd %hh:%nn:%ss, or, if extended to include microseconds, %yyyy-%mm-%dd %hh:%nn:%ss.x where x gives the number of decimal places seconds is given to. This applies to the arguments date, baseline date, given date, time, timestamp, and base timestamp. Functions that have days of week in the argument take a string specifying the day of the week, this applies to day of week and origin day.

Parallel Job Developers Guide

B-3

Logical Functions

Functions

Logical Functions
The following table lists the functions available in the Logical category (square brackets indicate an argument is optional):
Name
Not

Description
Returns the complement of the logical value of an expression Returns the bitwise AND of the two integer arguments Returns the bitwise OR of the two integer arguments Returns the bitwise Exclusive OR of the two integer arguments Returns a string containing the binary representation in "1"s and "0"s of the given integer Returns the integer made from the string argument, which contains a binary representation of "1"s and "0"s. Returns an integer with specific bits set to a specific state, where origfield is the input value to perform the action on, bitlist is a string containing a list of comma separated bit numbers to set the state of, and bitstate is either 1 or 0, indicating which state to set those bits.

Arguments
expression

Output
Complement (int8)

BitAnd

number 1 (uint64) number 2 (uint64) number 1 (uint64) number 2 (uint64)

number (uint64)

BitOr

number (uint64)

BitXOr

number 1 (uint64) number 2 (uint64)

number (uint64)

BitExpand

number (uint64)

string

BitCompress

number (string)

number (uint64)

SetBit

origfield (uint64) bitlist (string) bitstate (uint8)

number (uint64)

B-4

Parallel Job Developers Guide

Functions

Mathematical Functions

Mathematical Functions
The following table lists the functions available in the Mathematical category (square brackets indicate an argument is optional):
Name
Abs Acos

Description
Absolute value of any numeric expression Calculates the trigonometric arc-cosine of an expression Calculates the trigonometric arc-sine of an expression Calculates the trigonometric arc-tangent of an expression Calculates the smallest integer value greater than or equal to the given decimal value Calculates the trigonometric cosine of an expression Calculates the hyperbolic cosine of an expression Outputs the whole part of the real division of two real numbers (dividend, divisor) Calculates the result of base 'e' raised to the power designated by the value of the expression Calculates the absolute value of the given value Calculates the largest integer value less than or equal to the given decimal value Calculates a number from an exponent and mantissa Returns the absolute value of the given integer

Arguments
number (int32) number (dfloat)

Output
result (dfloat) result (dfloat)

Asin

number (dfloat)

result (dfloat)

Atan

number (dfloat)

result (dfloat)

Ceil

number (decimal)

result (int32)

Cos

number (dfloat)

result (dfloat)

Cosh Div

number (dfloat) dividend (dfloat) divisor (dfloat)

result (dfloat) result (dfloat)

Exp

number (dfloat)

result (dfloat)

Fabs Floor

number (dfloat) number (decimal)

result (dfloat) result (int32)

Ldexp

mantissa (dfloat) exponent (int32) number (uint64)

result (dfloat)

Llabs

result (int64)

Parallel Job Developers Guide

B-5

Mathematical Functions

Functions

Name
Ln

Description
Calculates the natural logarithm of an expression in base 'e' Returns the log to the base 10 of the given value Returns the greater of the two argument values Returns the lower of the two argument values Calculates the modulo (the remainder) of two expressions (dividend, divisor) Negate a number Calculates the value of an expression when raised to a specified power (expression, power) Return a psuedo random integer between 0 and 2321 Returns a random number between 0 232-1 Calculates the trigonometric sine of an angle Calculates the hyperbolic sine of an expression Calculates the square root of a number Calculates the trigonometric tangent of an angle Calculates the hyperbolic tangent of an expression

Arguments
number (dfloat)

Output
result (dfloat)

Log10 Max Min Mod

number (dfloat) number 1 (int32) number 2(int32) number 1 (int32) number 2 (int32) dividend (int32) divisor (int32)

result (dfloat) result (int32) result (int32) result (int32)

Neg Pwr

number (dfloat) expression (dfloat) power (dfloat)

result (dfloat) result (dfloat)

Rand

result (uint32)

Random Sin

number (dfloat)

result (uint32) result (dfloat)

Sinh Sqrt Tan

number (dfloat) number (dfloat) number (dfloat)

result (dfloat) result (dfloat) result (dfloat)

Tanh

number (dfloat)

result (dfloat)

B-6

Parallel Job Developers Guide

Functions

Null Handling Functions

Null Handling Functions


The following table lists the functions available in the Null Handling category (square brackets indicate an argument is optional):
Name
IsNotNull

Description
Returns true when an expression does not evaluate to the null value Returns true when an expression evaluates to the null value Change an in-band null to out of band null Returns an empty string if input column is null, otherwise returns the input column value Returns zero if input column is null, otherwise returns the input column value Returns specified value if input column is null, otherwise returns the input column value Assign a null value to the target column

Arguments
any

Output
true/false (int8)

IsNull

any

true/false (int8)

MakeNull

any (column) string (string) input column

NullToEmpty

input column value or empty string input column value or zero

NullToZero

input column

NullToValue

input column, value

input column value or value

SetNull

true = 1 false = 0

Number Functions
The following table lists the functions available in the Number category (square brackets indicate an argument is optional):
Name
MantissaFromDecimal

Description
Returns the mantissa from the given decimal

Arguments
number (decimal)

Output
result (dfloat)

Parallel Job Developers Guide

B-7

Raw Functions

Functions

Name
MantissaFromDFloat

Description
Returns the mantissa from the given dfloat

Arguments
number (dfloat)

Output
result (dfloat)

Raw Functions
The following table lists the functions available in the Raw category (square brackets indicate an argument is optional):
Name
RawLength

Description
Returns the length of a raw string

Arguments
input string (raw)

Output
Result (int32)

String Functions
The following table lists the functions available in the String category (square brackets indicate an argument is optional):
Name
AlNum

Description
Return whether the given string consists of alphanumeric characters Returns 1 if string is purely alphabetic Return the string after reducing all consective whitespace to a single space Compares two strings for sorting

Arguments
string (string)

Output
true/false (int8)

Alpha CompactWhiteSpace

string (string) string (string)

result (int8) result (string)

Compare

string1 (string) string2 (string) [justification (L or R)]

result (int8)

ComparNoCase ComparNum

Case insensitive comparison of two strings Compare the first n characters of the two strings

string1 (string) string2 (string) string1 (string) string2 (string) length (int16)

result (int8) result (int8)

CompareNumNoCase Caseless comparison of the first n characters of the two strings

string1 (string) string2 (string) length (int16)

result (int8)

B-8

Parallel Job Developers Guide

Functions

String Functions

Name
Convert

Description
Converts specified characters in a string to designated replacement characters Count number of times a substring occurs in a string Count number of delimited fields in a string Change all uppercase letters in a string to lowercase Enclose a string in double quotation marks Return 1 or more delimited substrings

Arguments
fromlist (string) tolist (string) expression (string) string (string) substring (string) string (string) delimiter (string) string (string) string (string) string (string) delimiter (string) occurrence (int32) [number (int32)]

Output
result (string)

Count

result (int32)

Dcount

result (int32)

DownCase DQuote Field

result (string) result (string) result (string)

Index

Find starting character position of substring Leftmost n characters of string

string (string) substring (string) occurrence (int32) string (string) number (int32)

result (int32)

Left

result (string)

Len Num PadString

Length of string in characters Return 1 if string can be converted to a number Return the string padded with the optional pad character and optional length Rightmost n characters of string

string (string) string (string) string (string) padlength (int32) string (string) number (int32)

result (int32) result (int8) result (string)

Right

result (string)

Soundex

Returns a string which identifies a set of words that are (roughly) phonetically alike based on the standard, open algorithm for SOUNDEX evaluation Return a string of N space characters Enclose a string in single quotation marks Repeat a string

string (string)

result (string)

Space Squote Str

length (int32) string (string) string (string) repeats (int32)

result (string) result (string) result (string)

Parallel Job Developers Guide

B-9

String Functions

Functions

Name
StripWhiteSpace Trim

Description
Return the string after stripping all whitespace from it Remove all leading and trailing spaces and tabs plus reduce internal occurrences to one

Arguments
string (string) string (string) [stripchar (string)] [options (string)]

Output
result (string) result (string)

TrimB TrimF Trim Leading Trailing Upcase

Remove all trailing spaces and tabs Remove all leading spaces and tabs Returns a string with leading and trailing whitespace removed Change all lowercase letters in a string to uppercase

string (string) string (string) string (string)

result (string) result (string) result (string)

string (string)

result (string)

true = 1 false = 0 Possible options for the Trim function are:


L Removes leading occurrences of character. T Removes trailing occurrences of character. B Removes leading and trailing occurrences of character. R Removes leading and trailing occurrences of character, and reduces multiple occurrences to a single occurrence. A Removes all occurrences of character. F Removes leading spaces and tabs. E Removes trailing spaces and tabs. D Removes leading and trailing spaces and tabs, and reduces multiple spaces and tabs to single ones.

B-10

Parallel Job Developers Guide

You might also like