Functions in Data Stage
Functions in Data Stage
Functions in Data Stage
The following table lists the functions that are available in the Date and Time category (Square brackets
indicate an argument is optional):
Date, Time, and Timestamp functions that specify dates, times, or timestamps in the argument
use strings with specific formats:
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.
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.
Logical Functions
The following table lists the functions available in the Logical category (square brackets indicate an
argument is optional):
Mathematical Functions
The following table lists the functions available in the Mathematical category (square brackets indicate
an argument is optional):
true = 1
false = 0
Number functions
The following table lists the functions available in the Number category (square brackets indicate an
argument is optional):
Raw functions
The following table lists the functions available in the Raw category (square brackets indicate an
argument is optional):
String functions
The following table lists the functions available in the String category (square brackets indicate an
argument is optional):
[justification (L or
R)]
ComparNoCase Case insensitive comparison of two string1 (string) result
strings string2 (string) (int8)
ComparNum Compare the first n characters of the string1 (string) result
two strings string2 (string) (int8)
length (int16)
CompareNumNoCase Caseless comparison of the first n string1 (string) result
characters of the two strings string2 (string) (int8)
length (int16)
Convert Converts specified characters in a string fromlist (string) result
to designated replacement characters (string)
tolist (string)
expression (string)
Count Count number of times a substring string (string) result
occurs in a string substring (string) (int32)
Dcount Count number of delimited fields in a string (string) result
string delimiter (string) (int32)
DownCase Change all uppercase letters in a string string (string) result
to lowercase (string)
DQuote Enclose a string in double quotation string (string) result
marks (string)
Name Description Arguments Output
Field Return 1 or more delimited substrings string (string) result
delimiter (string) (string)
occurrence (int32)
[number (int32)]
Index Find starting character position of string (string) result
substring substring (string) (int32)
occurrence (int32)
Left Leftmost n characters of string string (string) result
number (int32) (string)
Len Length of string in characters string (string) result
(int32)
Num Return 1 if string can be converted to a string (string) result
number (int8)
PadString Return the string padded with the string (string) result
optional pad character and optional padlength (int32) (string)
length
Right Rightmost n characters of string string (string) result
number (int32) (string)
Soundex Returns a string which identifies a set of string (string) result
words that are (roughly) phonetically (string)
alike based on the standard, open
algorithm for SOUNDEX evaluation
Space Return a string of N space characters length (int32) result
(string)
Squote Enclose a string in single quotation string (string) result
marks (string)
Str Repeat a string string (string) result
repeats (int32) (string)
StripWhiteSpace Return the string after stripping all string (string) result
whitespace from it (string)
Trim Remove all leading and trailing spaces string (string) result
and tabs plus reduce internal [stripchar (string)] (string)
occurrences to one [options (string)]
TrimB Remove all trailing spaces and tabs string (string) result
(string)
Name Description Arguments Output
TrimF Remove all leading spaces and tabs string (string) result
(string)
Trim Leading Returns a string with leading and string (string) result
Trailing trailing whitespace removed (string)
Upcase Change all lowercase letters in a string string (string) result
to uppercase (string)
true = 1
false = 0
Vector function
The following function can be used within expressions to access an element in a vector column. The
vector index starts at 0.
ElementAt(InLink.col1, 2) + 1
Rtype. The rtype argument is a string, and should contain one of the following:
ceil. Round the source field toward positive infinity. E.g, 1.4 -> 2, -1.6 -> -1.
floor. Round the source field toward negative infinity. E.g, 1.6 -> 1, -1.4 -> -2.
round_inf. Round or truncate the source field toward the nearest representable value,
breaking ties by rounding positive values toward positive infinity and negative values
toward negative infinity. E.g, 1.4 -> 1, 1.5 -> 2, -1.4 -> -1, -1.5 -> -2.
trunc_zero. Discard any fractional digits to the right of the rightmost fractional digit
supported in the destination, regardless of sign. For example, if the destination is an
integer, all fractional digits are truncated. If the destination is another decimal with a
smaller scale, round or truncate to the scale size of the destination decimal. E.g, 1.6 -> 1,
-1.6 -> -1.
Format string. Date, Time, and Timestamp functions that take a format string (e.g.,
timetostring(time, stringformat)) need to have the date format specified. The format strings are
described in Date and time formats.
Where your dates, times, or timestamps convert to or from ustrings, WebSphere DataStage will
pick this up automatically. In these cases the separators in your format string (for example, `:' or
`-') can themselves be Unicode characters.
fix_zero. By default decimal numbers comprising all zeros are treated as invalid. If the string
fix_zero is specified as a second argument, then all zero decimal values are regarded as valid.
Utility functions
The following table lists the functions available in the Utility category (square brackets indicate an
argument is optional):