Next
Topic: Load Specification Script Examples |
Setting Up the Data Load with the Load Specification Script
Advanced
Load Options: Analyzing and Manipulating Data with NDL++ Expressions
The NDL++ scripting language offers a wide variety of options for analyzing, manipulating, and converting data as it is loaded by ndlm. NDL++ provides both character string and math functions for performing data-type conversion and data analysis of specified fields. Certain kinds of data can also be generated for insertion into the target table (including current date and time, as well as a unique key for a specified group of fields). Variables can be declared to receive the output of data manipulation or analysis; these variables can then be used in statements or expressions elsewhere in the script. Conditional expressions can be used to specify courses of action that are to be taken only when certain conditions are present.
NDL++ functions can be used in the map specification (table) section and in the NULLIF, MISSINGIF, and SKIPIF clauses of ndlm import specification script files. They are typically included in the map specification to specify operations to be performed on input data. Analytical functions are useful for inclusion in variables and conditional expressions.
String Functions
The following table lists in alphabetical order the character string functions that can be used in NDL++ scripts, and provides a short description of each function along with its input and output data types. More detailed descriptions and examples are included in the NDL++ String Function Syntax and Examples section of the SAND CDBMS Tools Reference Guide.
Function Description CMP() Compares the ASCII values of two strings DATE() Returns the current date in a specified format GENKEY() Generates a unique key, 19 characters in length (RECORD section field input) GENKEYCOL() Generates a unique key, 19 characters in length (mapping section column input) INSTR() Determines the position of the first character of the first occurrence of one string within another INSTRREV() Determines the position of the last character of the last occurrence of one string within another ISNULL() Determines whether a column contains a null value ISNUMERIC() Determines whether a string is numeric LCASE() Converts a string to lowercase characters LEFT() Returns a specified number of characters from the left side of a string LEN() Returns the length of a string LPAD() Adds a specified character to the left side of a string to achieve a specified length LTRIM() Removes all instances of a specified character from the left side of a string MID() Returns a specified number of characters from a string PAD() Adds a specified character to both sides of a string to achieve a specified length REPLACE() Finds and replaces a substring within a string RIGHT() Returns a specified number of characters from the right side of a string RPAD() Adds a specified character to the right side of a string to achieve a specified length RTRIM() Removes all instances of a specified character from the right side of a string SPACE() Returns a string consisting of a specified number of spaces STR() Converts a numeric value into a string value STRING() Returns a string consisting of a specified character repeated a specified number of times STRREV() Reverses a string TIME() Returns the current time in a specified format TRIM() Removes all instances of a specified character from the left and right sides of a string UCASE() Converts a string to uppercase characters VALF() Converts a string containing numeric characters into a float value VALI() Converts a string containing numeric characters into an integer value
Math Functions
The following table lists in alphabetical order the math functions that can be used in NDL++ scripts, and provides a short description of each function along with its input and output data types. More detailed descriptions and examples are included in the NDL++ Math Functions Syntax and Examples section of the SAND CDBMS Tools Reference Guide.
Note:
When field values are to be considered as numeric values (float or integer type) by the NDL++ script interpreter, they must be declared as such in a TYPE section of the load specification script or in the appropriate portion of the RECORD section. Consult the SAND CDBMS Tools Reference Guide for more information.
Function Description ABS(x) Calculates the absolute value of x ATN(x) Calculates the arctangent of x in radians COS(x) Calculates the cosine of x in radians EXP(x) Calculates the exponential of x LOGN(x) Calculates the natural logarithm of x POW(x,y) Calculates x raised to the power of y ROUND(x) Rounds x to the decimal point SIGN(x) Determines the sign of x: returns 1 if x is positive, �1 if x is negative, and 0 if x is zero. SIN(x) Calculates the sine of x in radians. SQR(x) Calculates the square root of x TAN(x) Calculates the tangent of x in radians TRUNC(x) Truncates x at the decimal point
Use the following links to go to more detailed information about NDL++ scripts:
Next
Topic: Load Specification Script Examples |