Datastage Transformer Functions
Datastage Transformer Functions
Function Name
Syntax
BitAnd
BitAnd(352,400)
BitAnd(mylink.mynumber1,mylink.mynumber2)
BitCompress
BitExpand("0101100000")
BitExpand(mylink.mynumber)
BitExpand
BitExpand(352)
BitExpand(mylink.mynumber)
BitOr
BitOr(352,400)
BitOr(mylink.mynumber1,mylink.mynumber2)
BitXOr
BitXOr(352,400)
BitXOr(mylink.mynumber1,mylink.mynumber2)
Not(5-5)
Not(mylink.myexpression)
Not
Not(5+5)
Not(mylink.myexpression)
SetBit
SetBit(356,"2,4,8",1)
SetBit(mylink.origfield,mylink.bitlist,mylink.bitstate)
Logical functions
Example
Examples. If mylink.mynumber1 contains the number 352 and mylink.mynumber2 contains
the
number 400, then the following two functions are equivalent, and return the value 256
If mylink.mynumber1 contains the number 352, then the following two functions are
equivalent, and return the string "0101100000".
If mylink.myexpression contains the expression 5+5, then the following two functions are
equivalent, and return the value 0:
If mylink.origfield contains the number 352, mylink.bitlist contains the list "2,4,8",
and mylink.bitstate contains the value 1, then the following two functions are equivalent,
and
return the value 494
Description
Returns the bitwise AND of the two integer arguments.
v Input: number1 (uint64), number2 (uint64)
v Output: number (uint64)
Returns the integer made from the string argument, which contains a binary
representation of
"1"s and "0"s.
v Input: string
v Output: number (uint64)
Returns a string containing the binary representation in "1"s and "0"s of the given
integer.
v Input: number (uint64)
v Output: string
Returns the bitwise OR of the two integer arguments.
Appendix B. Parallel Transform functions 653
v Input: number1 (uint64), number2 (uint64)
v Output: number (uint64)
Returns the bitwise Exclusive OR of the two integer arguments.
v Input: number1 (uint64), number2 (uint64)
v Output: number (uint64)
Returns the complement of the logical value of an expression. If the value of expression
is true,
the Not function returns a value of false (0). If the value of expression is false, the NOT
function
returns a value of true (1). A numeric expression that evaluates to 0 is a logical value of
false. A
numeric expression that evaluates to anything else, other than the null value, is a logical
true. An
empty string is logically false. All other string expressions, including strings that include
an
empty string, spaces, or the number 0 and spaces, are logically true.
v Input: expression
v Output: complement (int8)
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.
v Input: origfield (uint64),bitlist (string),bitstate (uint8)
v Output: number (uint64)
Mathematical f
Function Name Syntax
Abs
Abs(12-34)
Abs(mylink.mynumber1-mylink.mynumber2)
Fabs
Fabs(-26.53)
Fabs(mylink.number)
Llabs
Llabs(-26)
Llabs(mylink.number)
Ceil
Ceil(2355.66)
Ceil(mylink.mynumber)
Floor
Floor(203.25)
Floor(mylink.number)
Div
Div(100,25)
Div(mylink.dividend,mylink.divisor)
Exp
Exp(5-1)
Exp(mylink.number-1)
Ldexp
Floor(2,3)
Floor(mylink.mantissa,mylink.exponent)
Ln
Ln(6)
Ln(mylink.number)
Log10
Log10(6)
Log10(mylink.number)
Max
Max(6,101)
Max(mylink.number1,mylink.number2)
Min
Min(6,101)
Min(mylink.number1,mylink.number2)
Mod
Mod(115,25)
Mod(mylink.dividend,mylink.divisor)
Neg
Neg(123)
Neg(mylink.number)
Pwr
Pwr(2,3)
Pwr(mylink.expression,mylink.power)
Rand
Rand()
Random
Random()
Sqrt
Sqrt(450)
Sqrt(mylink.mynumber)
Acos
Acos(0.707106781)
Acos(mylink.mynumber)
Asin
Asin(0.707106781)
Asin(mylink.mynumber)
Atan
Atan(135)
Atan(mylink.mynumber)
Cos
Cos(0.785398)
Cos(mylink.mynumber)
Cosh
Cosh(2)
Cosh(mylink.mynumber)
Sin
Sin(0.785398)
Sin(mylink.mynumber)
Sinh
Sinh(2)
Sinh(mylink.mynumber)
Tan
Tan(0.7853981)
Tan(mylink.mynumber)
Tanh
Tanh(2)
Tanh(mylink.mynumber)
athematical functions
Example
If mylink.number contains the number 2355.66, then the following two functions are
equivalent, and return the value 2356
If mylink.number contains the number 203.25, then the following two functions are
equivalent, and return the value 203
If mylink.number contains the number 5, then the following two functions are
equivalent, and return the value 54.5982
If mylink.expression contains the number 2, and mylink.power contains the number 3, then
the following two functions are equivalent, and return the value 8
Use this function to add a column to your output containing a random number
Use this function to add a column to your output containing a random number
If mylink.number contains the number 450, then the following two functions are
equivalent, and return the value 21.2132
If mylink.number contains the number 135, then the following two functions are
equivalent, and return the value 1.56339, which is the angle that has an arc tangent of 135
If mylink.number contains the number 0.785398, then the following two functions
are equivalent, and return the value 0.7071
If mylink.number contains the number 2, then the following two functions are
equivalent, and return the value 3.7622
If mylink.number contains the number 0.785398, then the following two functions
are equivalent, and return the value 0.7071
If mylink.number contains the number 2, then the following two functions are
equivalent, and return the value 3.62686
If mylink.number contains the number 0.7853981, then the following two functions
are equivalent, and return the value 0.7071
If mylink.number contains the number 2, then the following two functions are
equivalent, and return the value 0.964028
Description
Returns the absolute value of any numeric expression. The absolute value of an
expression is its unsigned magnitude.
v Input: numeric_expression (int32)
v Output: result (dfloat)
Calculates the absolute value of the given float value.
v Input: number (dfloat)
v Output: result (dfloat)
Calculates the absolute value of the given integer value.
v Input: number (integer)
v Output: result (unsigned integer)
Calculates the smallest integer value greater than or equal to the given decimal value.
v Input: number (dfloat)
v Output: result (int32)
Calculates the largest integer value less than or equal to the given decimal value.
v Input: number (dfloat)
v Output: result (int32)
Outputs the whole part of the real division of two real numbers (dividend, divisor).
v Input: dividend (dfloat), divisor (dfloat)
v Output: result (dfloat)
Calculates the result of base 'e' raised to the power designated by the value of the
expression. The
value of 'e' is approximately 2.71828. The expression must evaluate to a numeric value.
v Input: number (dfloat)
v Output: result (dfloat)
Returns a dfloat value from multiplying the mantissa by 2 raised to the power of the
exponent.
v Input: mantissa (dfloat), exponent (int32)
v Output: result (dfloat)
Calculates the natural logarithm of an expression in base 'e'. The value of 'e' is
approximately 2.71828. The expression must evaluate to a numeric value greater than 0
Returns the log to the base 10 of the given value
v Input: number (dfloat)
v Output: result (dfloat)
Returns the greater of the two argument values.
v Input: number1 (int32),number2(int32)
v Output: result (int32)
Null handling f
Function Name Syntax
IsNotNull
IsNull
NullToEmpty
NullToEmpty(mylink.mycolumn)
NullToZero
NullToZeroy(mylink.mycolumn)
NullToValue
NullToValue(mylink.mycolumn,42)
SetNull
setnull()
If the Derivation field for an output column contained the following code, then the
Transformer stage checks if the input column named mylink.mycolumn contains a null value.
If the input column contains a null, the output column contains zero. If the input column
does contain a null, then the output column contains the value from the input column.
If the Derivation field for an output column contained the following code, then the
Transformer stage checks if the input column named mylink.mycolumn contains a null value.
If the input column contains a null, the output column contains 42. If the input column does
contain a null, then the output column contains the value from the input column.
If the Derivation field for an output column contained the following code, then the
Transformer stage sets the output column to null:
Description
Returns true when an expression does not evaluate to the null value.
v Input: any
v Output: true/false (int8)
Returns an empty string if the input column is null, otherwise returns the input column
value.
v Input: input column
v Output: input column value or empty string
Returns zero if the input column is null, otherwise returns the input column value.
v Input: input column
v Output: input column value or zero
Returns the specified value if the input column is null, otherwise returns the input
column value.
v Input: input column, value
v Output: input column value or value
Assigns a null value to the target column.
v Input: v Output: -
Number fun
Function Name Syntax
AsDouble
AsDouble(56/4.32)
AsDouble(mylink.mynumber/4.32)
AsFloat
AsFloat(56/4.32)
AsFloat(mylink.mynumber/4.32)
AsInteger
AsInteger(56/4.32)
AsInteger(mylink.mynumber/4.32)
MantissaFromDecimal(243.7675)
MantissaFromDeci MantissaFromDecimal(mylink.mynumber)
MantissaFromDFloaMantissaFromDFloat(mylink.mynumber)
Number functions
Example
In the following expression, the input column mynumber contains an integer, but
the function outputs a double. If mylink.mynumber contains the value 56, then the following
two functions are equivalent, and return the value 1.29629629629629619E+01:
In the following expression, the input column mynumber contains an integer, but
the function outputs a float. If mylink.mynumber contains the value 56, then the following
two functions are equivalent, and return the value 1.29629629629629619E+01:
In the following expression, the input column mynumber contains a double, but the function
is output an integer. If mylink.mynumber contains the value 56, then the following two
functions are equivalent, and return the value 12:
If mylink.number contains the number 243.7675, then the following two functions
are equivalent, and return the value 7675:
If mylink.number contains the number 1.234412000000000010E +4, then the
following function returns the value 1:
Description
Raw funct
Function Name Syntax
RawLength
RawLength(mylink.rawdata)
Raw functions
Example
If mylink.rawdata contains the raw data from a bitmap, then the following function
returns the size of the bitmap in bytes:
Description
Returns the length of a raw string.
v Input: input string (raw)
v Output: result (int32)
String functi
Function Name
Syntax
AlNum(mylink.mystring1)
AlNum
AlNum(mylink.mystring2)
Alpha(mylink.mystring1)
Alpha
Alpha(mylink.mystring2)
CompactWhiteSpacCompactWhiteSpace(mylink.mystring)
Compare(mylink.mystring1,mylink.mystring2,L
)
Compare
Compare(mylink.mystring1,mylink.mystring2,R
)
CompareNoCase
CompareNoCase(mylink.mystring1,mylink.myst
ring2)
CompareNum
CompareNum(mylink.mystring1,mylink.mystrin
g2,4)
CompareNumNoCase(mylink.mystring1,mylink.
CompareNumNoCas
mystring2,4)
Convert
Convert("TI","XY",mylink.mystring1)
Count
Count(mylink.mystring1,"choc")
Dcount
Dcount(mylink.mystring1,",")
DownCase
DownCase(mylink.mystring1)
DQuote
DQuote(mylink.mystring1)
Field(mylink.mystring1,",",2)
Field
Field(mylink.mystring1,",",2,2)
Index
Index(mylink.mystring1,"chocolate",2)
Left
Left(mylink.mystring1,9)
Len
Len(mylink.mystring1)
Num(mylink.mystring1)
Num
Num(mylink.mystring1)
PadString
PadString(mylink.mystring1,"0",5)
Right
Right(mylink.mystring1,7)
Soundex(mylink.mystring1)
Soundex
Soundex(mylink.mystring1)
Space
Space(mylink.mylength)
SQuote
SQuote(mylink.mystring1)
Str
Str(mylink.mystring1,5)
StripWhiteSpace
StripWhiteSpace(mylink.mystring)
Trim(mylink.mystring)
Trim(mylink.mystring,".")
Trim(mylink.mystring,".","A")
Trim
Trim(mylink.mystring,".","T")
TrimB
TrimB(mylink.mystring)
TrimF
TrimF(mylink.mystring)
TrimLeadingTrailingTrimLeadingTrailing(mylink.mystring)
UpCase
UpCase(mylink.mystring1)
Generating a
sequence number
in datastage
(numpartion*rwonum)+partinnum-numpartition+1
String functions
Example
If mylink.mystring1 contains the string "12 red roses", then the following function
would return the value 0 (false).
If mylink.mystring2 contains the string "twelve red roses", then the following function would
return the value 1 (true).
If mylink.mystring contains the string "too many
function returns the string "too many spaces":
If mylink.mystring1 contains the string "NOW IS THE TIME", then the following
function returns the string "NOW YS XHE XYME".
If mylink.mystring1 contains the string "chocolate drops, chocolate ice cream,
chocolate bars", then the following function returns 3.
If mylink.mystring1 contains the string "chocolate drops, chocolate ice cream,
chocolate bars", then the following function returns 3.
If mylink.mystring1 contains the string "CaMel cAsE", then the following function returns the
string "camel case".
If mylink.mystring1 contains the string needs quotes, then the following function
returns the string "needs quotes".
If mylink.mystring1 contains the string "chocolate drops, chocolate ice cream,
chocolate bars, chocolate dippers", then the following function returns the string " chocolate
ice cream".
If mylink.mystring1 contains the string "chocolate drops, chocolate ice cream, chocolate
bars, chocolate dippers", then the following function returns the string " chocolate ice cream,
chocolate bars".
If mylink.mystring1 contains the string "Griffin" then the following function returns the code
"G615".
If mylink.mystring1 contains the string "Griphin" then the following function also returns the
code "G615".
If mylink.mylength contains the number 100, then the following function returns a string
that contains 100 space characters.
If mylink.mystring1 contains the string needs quotes, then the following function returns the
string 'needs quotes'.
If mylink.mystring1 contains the string needs "choc", then the following function returns the
string "chocchocchocchocchoc".
If mylink.mystring contains the string "too
returns the string "toomanyspaces":
many
If mylink.mystring contains the string " String with whitespace ", then the following function
returns the string "String with whitespace":
Trim(mylink.mystring)
If mylink.mystring contains the string "..Remove..redundant..dots....", then the following
function returns the string "Remove.redundant.dots":
Trim(mylink.mystring,".")
If mylink.mystring contains the string "Remove..all..dots....", then the following function
returns the string "Removealldots":
Trim(mylink.mystring,".","A")
If mylink.mystring contains the string "Remove..trailing..dots....", then the following function
returns the string "Remove..trailing..dots":
Trim(mylink.mystring,".","T")
If mylink.mystring contains the string "too many trailing spaces
following function returns the string "too many trailing spaces":
KeyMgtGetNextVal
KeyMgtGetNextValConn
Or
NextSurrogatekey()
Description
Compares two strings for sorting. The comparison can be left-justified (the default) or
right-justified. A right-justified comparison compares numeric substrings within the
specified strings as numbers. The numeric strings must occur at the same character
position in each string.
For example, a right-justified comparison of the strings AB100 and AB99 indicates that
AB100 is greater than AB99 since 100 is greater than 99. A right-justified comparison of
the strings AC99 and AB100 indicates that AC99 is greater since C is greater than B.
v Input: string1 (string), string2 (string), [justification (L or R)]
v Output: result (int8), can be -1 for string1 is less than string2, 0 for both strings are the
same, 1 for string1 is greater than string2.
Compares two strings for sorting, ignoring their case.
v Input: string1 (string), string2 (string)
v Output: result (int8), can be -1 for string1 is less than string2, 0 for both strings are the
same, 1 for string1 is greater than string2.
Compares the first n characters of two strings.
v Input: string1 (string), string2 (string), length (int16)
v Output: result (int8), can be -1 for string1 is less than string2, 0 for both strings are the
same, 1 for string1 is greater than string2.
Compares the first n characters of two strings, ignoring their case.
v Input: string1 (string), string2 (string), length (int16)
v Output: result (int8), can be -1 for string1 is less than string2, 0 for both strings are the
same, 1 for string1 is greater than string2.
Returns one or more substrings located between specified delimiters in a string. The
argument occurrence specifies which occurrence of the delimiter is to be used as a
terminator. The argument number optionally specifies how many substrings to return.
v Input: string (string), delimiter (string), occurrence (int32), [number (int32)]
v Output: result (string)
Finds the starting character position of a substring. The argument occurrence specifies
which occurrence of the substring is to be located.
v Input: string (string), substring (string), occurrence (int32)
v Output: result (int32)
Returns the leftmost n characters of a string.
v Input: string (string) number (int32)
v Output: result (string)
Returns the length of a string in characters.
v Input: string (string)
v Output: result (int32)
Returns a code which identifies a set of words that are (roughly) phonetically alike based
on the standard, open algorithm for SOUNDEX evaluation.
v Input: string (string)
v Output: result (string)
Returns a string of n space characters.
v Input: length (int32)
v Output: result (string)
Encloses a string in single quotation marks.
v Input: string (string)
v Output: result (string)
Repeats a string the specified number of times.
v Input: string (string) repeats (int32)
v Output: result (string)
Returns the string after removing all whitespace characters from it.
v Input: string (string)
v Output: result (string)
Remove all leading and trailing spaces and tabs plus reduce internal occurrences to one.
The argument stripchar optionally specifies a character other than a space or a tab. The
argument options optionally specifies the type of trim operation to be performed and
contains one or more of the following values:
A Remove all occurrences of stripchar
B Remove both leading and trailing occurrences of stripchar
D Remove leading, trailing, and redundant white-space characters
E Remove trailing white-space characters
F Remove leading white-space characters
L Remove all leading occurrences of stripchar
R Remove leading, trailing, and redundant occurrences of stripchar
T Remove all trailing occurrences of stripchar
v Input: string (string) [stripchar (string)] [options (string)]
v Output: result (string)
Removes all trailing spaces and tabs from a string.
v Input: string (string)
v Output: result (string)
Removes all leading spaces and tabs from a string.
v Input: string (string)
v Output: result (string)
Removes all leading and trailing spaces and tabs from a string.
v Input: string (string)
v Output: result (string)
Changes all lowercase letters in a string to uppercase.
v Input: string (string)
v Output: result (string)
Vector func
Function Name Syntax
ElementAt(mylink.myvector, 2)
ElementAt
ElementAt(mylink.myvector, 2) + 1
Vector functions
Example
The following example outputs the second element of the vector in the column
mylink.myvector.
The following example outputs the second element of the vector in the column
mylink.myvector and adds one it.
Description
Accesses an element of a vector. The vector index starts at 0. The function can be used
as part of, or the whole of an expression.
v Input: input_column (column name) index (int)
v Output: element of vector
Type conversi
Syntax
Char
Char(65)
DateToString(mylink.mydate)
DateToString
DateToString(mylink.mydate, "%dd:%mm:%yyyy")
DateToDecimal (mylink.basedate)
DecimalToDate (mylink.basedate)
DecimalToDecimal(mylink.mydec,"ceil")
DecimalToDecimal(mylink.mydec,"floor")
DecimalToDecimal(mylink.mydec,"trunc_zero")
DecimalToDecimal
DecimalToDecimal(mylink.mydec,"round_inf")
DecimalToDFloat(mylink.mydec,"fix_zero")
DecimalToDFloat(mylink.mydec)
DecimalToDFloat
DecimalToString(mylink.mydec,"suppress_zero")
DecimalToString(mylink.mydec,"fix_zero")
DecimalToString
DecimalToString(mylink.mydec)
DecimalToTime(mylink.mytimedec)
DecimalToTime
DecimalToTime(mylink.mytimedec, "%ss%nn%hh")
DecimalToTimestamp(mylink.mytimestampdec)
DecimalToTimestamp
DecimalToTimestamp(mylink.mytimestampdec, "%hh
%nn%ss%yy%mm%dd")
DFloatToDecimal(mylink.mydec,"ceil")
DFloatToDecimal(mylink.mydec,"floor")
DFloatToDecimal(mylink.mydec,"trunc_zero")
DFloatToDecimal
DFloatToDecimal(mylink.mydec,"round_inf")
DfloatToStringNoExp
DfloatToStringNoExp(mylink.myfloat,2)
IsValid("int8",mylink.mystring)
IsValid
IsValid("int8",mylink.mystring)
IsValidDate(mylink.mydate)
IsValidDate
IsValidDate(StringToDate (mylink.mydate))
IsValidDecimal(mylink.mynum)
IsValidDecimal
IsValidDecimal(StringToDecimal (mylink.mynum))
IsValidTime(mylink.mytime)
IsValidTime
IsValidTime(StringToTime (mylink.mytime))
IsValidTimestamp(mylink.mytimestamp)
IsValidTimestamp
IsValidTimestamp(StringToTimestamp
(mylink.mytimestamp))
RawNumAt(mylink.myraw, 0)
RawNumAt
RawNumAt(mylink.myraw, 12)
RawToString
RawNumAt(mylink.myraw)
Seq
Seq("A")
SeqAt
SeqAt(mylink.mystring, 1)
StringToDate(mylink.mystring)
StringToDate
StringToDecimal
StringToRaw
StringToTime
StringToTimestamp
StringToUstring
TimestampToDate
TimestampToDecimal
TimestampToString
TimestampToTime
TimeToString
TimeToDecimal
UstringToString
StringToDate(mylink.mystring,"%dd:%mm:%yyyy")
pe conversion functions
The following example outputs the date contained in the column mylink.mydate to a string.
If mylink.mydate contains the date 18th August, 2009, then the output string is "2009-0818":
The following example outputs the date contained in the column mylink.mydate to a string
with the format dd:mm:yyyy. If mylink.mydate contained the date 18th August, 2009, then
the output string would be "18:08:2009":
If the column mylink.basedate contains the date 2012-08-18, then the following
function stores the date as the decimal number 18082012:
If the column mylink.basedate contains the date 2012-08-18, and the target column has a
length of 10 and a scale of 2, then the following function stores the date as the decimal
number 201208.18:
If the column mylink.mydecdata contains the value 18082012, then the following
function returns the date 2012-08-18:
If the column mylink.mydecdata contains the value -201208.18, then the following function
returns the date 2012-08-18:
If the column mylink.mydec contains the decimal number 2.5345, the following
function returns the decimal number 00000002.54.
DecimalToDecimal(mylink.mydec,"ceil")
The following function returns the decimal number 00000002.53.
DecimalToDecimal(mylink.mydec,"floor")
The following function returns the decimal number 00000002.53.
DecimalToDecimal(mylink.mydec,"trunc_zero")
The following function returns the decimal number 00000002.53.
DecimalToDecimal(mylink.mydec,"round_inf")
In all these examples, the target decimal has a length of 10 and a scale of 2.
If the column mylink.mydec contains the decimal number 00000004.00 the following
function returns the dfloat number 4.00000000000000000E+00.
DecimalToDFloat(mylink.mydec,"fix_zero")
If the column mylink.mydec contains the decimal number 00012344.00 the following
function returns the dfloat number 1.23440000000000000E+04.
DecimalToDFloat(mylink.mydec,"fix_zero")
If the column mylink.mydec contains the decimal number 00012344.120 the following
function returns the dfloat number 1.23441200000000010E+04.
DecimalToDFloat(mylink.mydec,"fix_zero")
If the column mylink.mydec contains the decimal number 00012344.120 the following
function returns the dfloat number 1.23441200000000010E+04.
DecimalToDFloat(mylink.mydec)
If the column mylink.mydec contains the decimal number 00012344.000 the following
function returns the dfloat number 1.23440000000000000E+04.
DecimalToDFloat(mylink.mydec)
If the column mylink.mydec contains the decimal number 00000004.00, the following
function returns the string "4":
DecimalToString(mylink.mydec,"suppress_zero")
If the column mylink.mydec contains the decimal number 00000004.00, the following
function returns the string "0000000000000000000000000004.0000000000".
DecimalToString(mylink.mydec,"fix_zero")
If the column mylink.mydec contains the decimal number 00012344.00, the following
function returns the string "12344".
DecimalToString(mylink.mydec,"suppress_zero")
If the column mylink.mydec contains the decimal number 00012344.00, the following
function returns the string "0000000000000000000000012344.0000000000".
DecimalToString(mylink.mydec,"fix_zero")
If the column mylink.mydec contains the decimal number 00012344.120, the following
function returns the string "0000000000000000000000012344.1200000000".
DecimalToString(mylink.mydec,"fix_zero")
If the column mylink.mydec contains the decimal number 00012344.120, the following
function returns the string "12344.12":
DecimalToString(mylink.mydec,"suppress_zero")
If the column mylink.mydec contains the decimal number 00012344.120, the following
function returns the string "0000000000000000000000012344.120000000".
DecimalToString(mylink.mydec)
If the column mylink.mydec contains the decimal number 00012344.000, the following
function returns the string "0000000000000000000000012344.0000000000".
DecimalToString(mylink.mydec)
If the column mylink.mytimedec contains the decimal value 200658, then the
following function returns the time 20:06:58:
DecimalToTime(mylink.mytimedec)
If the column mylink.mytimedec contains the decimal value 580620, then the following
function returns the time 20:06:58:
DecimalToTime(mylink.mytimedec, "%ss%nn%hh")
If the column mylink.myfloat contains the dfloat number 2.534, the following
function returns the decimal number 00000002.54.
DFloatToDecimal(mylink.mydec,"ceil")
If the column mylink.myfloat contains the dfloat number 2.534, the following function
returns the decimal number 00000002.53.
DFloatToDecimal(mylink.mydec,"floor")
If the column mylink.myfloat contains the dfloat number 2.534, the following function
returns the decimal number 00000002.53.
DFloatToDecimal(mylink.mydec,"trunc_zero")
If the column mylink.myfloat contains the dfloat number 2.534, the following function
returns the decimal number 00000002.53.
DFloatToDecimal(mylink.mydec,"round_inf")
If the column mylink.myfloat contains the dfloat number 2.534, then the following function
returns the string 00000002.50
If the column mylink.mystring contains the string "1", then the following function returns the
value 1.
IsValid("int8",mylink.mystring)
If the column mylink.mystring contains the string "380096.06", then the following function
returns the value 0.
IsValid("int8",mylink.mystring)
If the column mylink.mydate contains the date 2011-09-13, then the following
function returns the value 1.
IsValidDate(mylink.mydate)
If the column mylink.mydate contains the string "380096.06", then the following function
returns the value 0, because the converted string is not a valid date.
IsValidDate(StringToDate (mylink.mydate))
If the column mylink.mynum contains the value 310007.65, then the following
function returns the value 1.
IsValidDecimal(mylink.mynum)
If the column mylink.mynum contains the string "wake-robin", then the following function
returns the value 0, because the converted string is not a valid decimal.
IsValidDecimal(StringToDecimal (mylink.mynum))
If the column mylink.mytime contains the time 23:09:22, then the following function returns
the value 1:
IsValidTime(mylink.mytime)
If the column mylink.mydate contains the string "IbnKayeed", then the following function
returns the value 0, because the converted string is not a valid time.
IsValidTime(StringToTime (mylink.mytime))
If the column mylink.mytimestamp contains the time 2011-09-13 23:09:22, then the
following function returns the value 1:
IsValidTimestamp(mylink.mytimestamp)
If the column mylink.mytimestamp contains the string "one of two", then the following
function returns the value 0, because the converted string is not a valid timestamp.
IsValidTimestamp(StringToTimestamp (mylink.mytimestamp))
If the column mylink.myraw contains a raw value derived from the string "hello",then the
following function returns the integer 0x68 (the ASCII code for the character h):
RawNumAt(mylink.myraw, 0)
If the column mylink.myraw contains a raw value derived from the string "hello", then the
following function returns 0 because the specified index is out of range:
RawNumAt(mylink.myraw, 12)
If the column mylink.myraw contains the value { 0x31 0x31 0x30 0x35 0x32 0x32
0x30 0x39 }, then the following function returns the string "11052209".
RawNumAt(mylink.myraw)
The following example outputs the character A as the ASCII code 65.
Seq("A")
If the column mylink.mystring contains the string "horse", then the following
function returns the value 0x6F (that is, the ASCII value of the character o).
SeqAt(mylink.mystring, 1)
If the column mylink.mystring contains the string 19580818 , then the following function
returns the date 19580818.
StringToDate(mylink.mystring)
If the column mylink.mystring contains the string 18:08:1958 , then the following function
returns the date 19580818.
StringToDate(mylink.mystring,"%dd:%mm:%yyyy")
Description
Generates an ASCII character from its numeric code value. You can optionally specify the allow8bits
argument to convert 8-bit ASCII values.
v Input: code (number), [allow8bits]
v Output: result (char)
Returns the string representation of the given date. The format of the string can optionally be
specified.
v Input: date (date), [format (string)]
v Output: result (string)
Returns the given date as a packed decimal value. If your target decimal specifies a scale, part of
the date appears after the decimal point. You can optionally specify a format string that specifies
how the date is stored in the decimal number. The default format string is "%yyyy%mm%dd", so,
for example, the date 2009-08-25 is stored as the decimal number 20090825. Format strings can
only specify a format that contains numbers. For example, you cannot specify a format string
such as "%yyyy-%mm-%dd", because the hyphen character (-) cannot be stored in a packed
decimal value. The following tokens are valid for conversions to or from decimal values:
%yyyy (four-digit year)
%yy (two-digit year)
%NNNNyy (two-digit year with cutoff)
%mm (two-digit month)
%dd (two-digit day of month)
%ddd (three-digit day of year)
The literal digits 0 to 9 are also valid.
v Input: basedate (date) [, format (string)]
v Output: converted_date (decimal)
Returns the given packed decimal as a date. Both the sign and the scale of the decimal number are
ignored when it is converted to a date. You can optionally specify a format string that specifies how
the date is stored in the decimal number. The default format string is "%yyyy%mm%dd", so, for
example, the date 2009-08-25 is stored as the decimal number 20090825. Format strings can only
specify a format that contains numbers. For example, you cannot specify a format string such as
"%yyyy-%mm-%dd", because the hyphen character (-) cannot be stored in a packed decimal value.
The following tokens are valid for conversions to or from decimal values:
%yyyy (four-digit year)
%yy (two-digit year)
%NNNNyy (two-digit year with cutoff)
%mm (two-digit month)
%dd (two-digit day of month)
%ddd (three-digit day of year)
The literal digits 0 to 9 are also valid.
v Input: basedec (decimal) [, format (string)]
v Output: date
Returns the given decimal in decimal representation with precision and scale specified in the target
column definition. The argument rtype optionally specifies a rounding type, and is set to one of the
following values:
ceil. Round the source field toward positive infinity. For example, 1.4 -> 2, -1.6 -> -1.
floor. Round the source field toward negative infinity. For example, 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. For
example, 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. For example, 1.6 -> 1, -1.6 -> -1.
v Input: decimal (decimal) [,rtype (string)]
v Output: result (decimal)
Returns the given decimal in dfloat representation. The argument "fix_zero" optionally specifies that
all zero decimal values are regarded as valid (by default, decimal numbers comprising all zeros are
treated as invalid).
v Input: decimal (decimal) [,"fix_zero"]
v Output: result (dfloat)
Returns the given decimal as a string. The argument "fix_zero" optionally specifies that all zero
decimal values are regarded as valid (by default, decimal numbers comprising all zeros are treated as
invalid). This covers the case where the sign bits of the packed decimal representation
are all 0 as well as all the content digits. This cast is not considered valid unless "fix_zero" is true.
v Input: decimal (decimal) [,"fix_zero"]
v Output: result (string)
Returns the given packed decimal as a time. You can optionally specify a format string that specifies
how the time is stored in the decimal number. The default format string is "%hh%nn%ss", so, for
example, the time 14:03:22 is stored as the decimal number 140322. Format strings can only specify
a format that contains numbers. For example, you cannot specify a format string such as "%hh:%nn:
%ss", because the colon character (:) cannot be stored in a packed decimal value. The following
tokens are valid for conversions to or from decimal values:
%hh (two-digit hours using 24-hour clock)
%nn (two-digit minutes)
%ss (two-digit seconds)
%ss.N (two-digit seconds, plus the number of fractional digits allowed. The number of fractional digits
is from one to six inclusive).
The literal digits 0 to 9 are also valid.
If your specified format includes microseconds (for example, %ss.4), then the position of the decimal
point is inferred in the decimal value. The position of the decimal point does not have to coincide with
the specified scale of the decimal (for example, scale = 4).
v Input: time (time) [, format (string)]
v Output: result (decimal)
Returns the given packed decimal as a timestamp. You can optionally specify a format string that
specifies how the timestamp is stored in the decimal number. The default format string is "%yyyy
%mm%dd%hh%nn%ss", so, for example, the timestamp 2009-08-25 14:03:22 is stored as the decima
number 20090825140322. Format strings can only specify a format that contains numbers.
For example, you cannot specify a format string such as "%yyyy/%mm/%dd%hh:%nn:%ss", because
the slash character (/) and the colon character (:) cannot be stored in a packed decimal value. The
following tokens are valid for conversions to or from decimal values:
%yyyy (four-digit year)
%yy (two-digit year)
%NNNNyy (two-digit year with cutoff)
%mm (two-digit month)
Appendix B. Parallel Transform functions 671
%dd (two-digit day of month)
%ddd (three-digit day of year)
%hh (two-digit hours using 24-hour clock)
%nn (two-digit minutes)
%ss (two-digit seconds)
%ss.N (two-digit seconds, plus the number of fractional digits allowed. The number of fractional digits
is from one to six inclusive).
The literal digits 0 to 9 are also valid.
If your specified format includes microseconds (for example, %ss.4), then the position of the decimal
point is inferred in the decimal value. The position of the decimal point does not have to coincide with
the specified scale of the decimal (for example, scale = 4).
v Input: timestamp (timestamp) [, format (string)]
v Output: result (decimal)
Returns the given dfloat in decimal representation. The argument rtype optionally specifies a rounding
type, and is set to one of the following values:
ceil. Round the source field toward positive infinity. For example, 1.4 -> 2, -1.6 -> -1.
floor. Round the source field toward negative infinity. For example, 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. For
example, 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. For example, 1.6 -> 1, -1.6 -> -1.
v Input: number (dfloat), [rtype (string)]
v Output: result (decimal)
Returns the given dfloat in its string representation with no exponent, using the specified scale.
v Input: number (dfloat), scale (string)
v Output: result (string)
Returns whether the given string is valid for the given type. Valid types are "date", "decimal",
"dfloat", "sfloat", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "raw", "string",
"time", "timestamp", "ustring". For data types of date, time, and timestamp, you can optionally
specify a format string. The format string describes the format that your input data uses when it
differs from the default formats for date, time, or timestamp. The default format for date is %yyyy%mm-%dd. The default format for time is "%hh:%mm:%ss". The default format for timestamp is
%yyyy-%mm-%dd %hh:%mm:%ss". This function does not log warnings.
v Input: type (string), teststring (string) [, format (string)]
v Output: result (int8)
Returns whether the given value is valid for the type date. This function logs warnings.
v Input: testdate (date)
v Output: result (int8)
Returns whether the given value is valid for the type decimal. If the allzerosflag is set to 0, then an all
zeroes representation is not valid. The allzerosflag is set to zero by default.
v Input: testvalue (decimal) [, allzerosflag (uint8)]
v Output: result (int8)
Returns whether the given time is valid for the type time.
v Input: testtime (time)
v Output: result (int8)
Returns whether the given timestamp is valid for the type timestamp.
v Input: testtimestamp (timestamp)
v Output: result (int8)
Returns the integer value at the specified index value in the specified raw field. The index starts at 0.
v Input: rawfield (raw), index (int32)
v Output: result (int32)
Returns the given raw value as a string representation. You must ensure that the raw input value
contains a sequence of bytes that are valid as characters in the target character set in which the
output string is used. For example, the raw value { 0xE0 0x41 0x42 } is not a valid sequence of UTF-8
characters, since the lead byte, 0xE0, is supposed to be followed by a byte in the range [0x80..0xBF].
If a raw value { xE0 x41 x42 } is passed to the RawToString function, there could be an error if the
output string is then accessed as if it were encoded in UTF-8.
v Input: rawfield (raw)
v Output: result (string)
Generates a numeric code value from an ASCII character. You can optionally specify the allow8bits
argument to convert 8-bit ASCII values.
v Input: Seq (char)
v Output: result (number)
Returns the numeric code point value of the character at the specified position in the given string. The
index starts at 0. If the specified index is out of range, the function returns 0.
v Input: basestring (string), index (int32)
v Output: result (int32)
Returns a date from the given string in the given format. You do not have to specify a format string if
your string contains a date in the default format yyyy-mm-dd.
v Input: string (string) [,format (string)]
v Output: result (date)
Returns the given string as a decimal representation. The argument rtype optionally specifies a
rounding type, and is set to one of the following values:
ceil. Round the source field toward positive infinity. For example, 1.4 -> 2, -1.6 -> -1.
floor. Round the source field toward negative infinity. For example, 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. For
example, 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. For example, 1.6 -> 1, -1.6 -> -1.
v Input: string (string), [rtype (string)]
v Output: result (decimal)
Syntax
GetEnvironment
GetEnvironment("<environment variable>")
GetSavedInputRecord GetSavedInputRecord()
NextSKChain
Example
If you queried the value of the environment
variable name
APT_RDBMS_COMMIT_ROWS then the
following derivation might return the value
"2048".
GetEnvironment("APT_RDBMS_COMMIT_ROW
S")
Description
This function is used to implement the aggregating of data on the input link of a Transformer
stage. You call the GetsSavedInputRecord function to a retrieve an input row that you have
previously saved to a cache area. The function retrieves the next input row from the cache (in the
order in which they were saved to the cache) and makes it the current input row. The retrieved
row overrides what was the current input row, and so any derivation using an input column
value will use the value of that column in the input row retrieved from the cache, not what was
previously the current input row. You must call GetSavedInputRecord in a loop variable
derivation, you cannot call it from anywhere else. For example, you cannot call
GetSavedInputRecord in the Loop Condition expression. You can call GetSavedInputRecord,
multiple times and retrieve the next cached row on each call. Use the SaveInputRecord function
to store rows to the cache. GetSavedInputRecord returns the cache index number of the record
retrieved from that cache.
v Input: v Output: cache_index_number
Buffering
APT_BUFFER_FREE_RUN
APT_BUFFER_MAXIMUM_MEMORY
APT_BUFFER_MAXIMUM_TIMEOUT
APT_BUFFER_DISK_WRITE_INCREMENT
APT_BUFFERING_POLICY
APT_DISABLE_ROOT_FORKJOIN
APT_SHARED_MEMORY_BUFFERS
Compiler
APT_COMPILER
APT_COMPILEOPT
APT_LINKER
APT_LINKOPT
DB2 Support
APT_DB2INSTANCE_HOME
APT_DB2READ_LOCK_TABLE
APT_DBNAME
APT_RDBMS_COMMIT_ROWS
DB2DBDFT
Decimal Support
APT_DECIMAL_INTERM_PRECISION
APT_DECIMAL_INTERM_SCALE
APT_DECIMAL_INTERM_ROUND_MODE
Disk I/O
APT_BUFFER_DISK_WRITE_INCREMENT
APT_CONSISTENT_BUFFERIO_SIZE
APT_EXPORT_FLUSH_COUNT
APT_IO_MAP/APT_IO_NOMAP and APT_BUFFERIO_MAP/APT_BUFFERIO_NOMAP
APT_PHYSICAL_DATASET_BLOCK_SIZE
Job Monitoring
APT_MONITOR_SIZE
APT_MONITOR_TIME
APT_NO_JOBMON
APT_PERFORMANCE_DATA
Oracle Support
APT_ORACLE_LOAD_OPTIONS
APT_ORACLE_NO_OPS
APT_ORACLE_PRESERVE_BLANKS
APT_ORA_IGNORE_CONFIG_FILE_PARALLELISM
APT_ORA_WRITE_FILES
APT_ORAUPSERT_COMMIT_ROW_INTERVAL APT_ORAUPSERT_COMMIT_TIME_INTERVAL
Partitioning
APT_NO_PART_INSERTION
APT_NO_PARTSORT_OPTIMIZATION on page 72
APT_PARTITION_COUNT
APT_PARTITION_NUMBER
APT_MAX_DELIMITED_READ_SIZE
APT_PREVIOUS_FINAL_DELIMITER_COMPATIBLE
APT_STRING_PADCHAR
Reporting
APT_DUMP_SCORE
APT_ERROR_CONFIGURATION
APT_MSG_FILELINE
APT_PM_PLAYER_MEMORY
APT_PM_PLAYER_TIMING
APT_RECORD_COUNTS
OSH_DUMP
OSH_ECHO
OSH_EXPLAIN
OSH_PRINT_SCHEMAS
Sorting
APT_NO_SORT_INSERTION
APT_SORT_INSERTION_CHECK_ONLY
TMPDIR
to /tmp. It
is used for
miscellan
eous
internal
temporary
data,
including
FIFO
queues
and
Transform
er
temporary
storage.
As a
minor
optimizati
on, it can
be better
to ensure
that it
is set to a
file
system
separate
to the
InfoSpher
e
DataStage
install
directory.
The descriptor file for a data set contains the following information:
v Data set header information.
v Creation time and date of the data set.
v The schema of the data set.
v A copy of the configuration file use when the data set was created.
For each segment, the descriptor file contains:
v The time and date the segment was added to the data set.
v A flag marking the segment as valid or invalid.
v Statistical information such as number of records in the segment and number of
bytes.
v Path names of all data files, on all processing nodes.
This information can be accessed through the Data Set Manager.