Previous Topic: OverviewNext Topic: Sample COBOL Function


Functions

Notation

Function

Meaning

U

ABS(number)

Absolute value of number

U

ACOS(float)

Arccosine, in radians, of float

U

ASIN(float)

Arcsine, in radians, of float

U

ATAN(float)

Arctangent, in radians, of float

U

ATAN2(float1, float2)

Arctangent, in radians, of float2/float1

B

CAST(number or null, AS datatype)

Converts value-expression to a specified data type.

B

CEIL(number)

Smallest integer greater than or equal to number data type. (Same as CEILING.)

B

CEILING(number)

Smallest integer greater than or equal to number. (Same as CEIL.)

B

CHAR(code)

Character with ASCII code value code, where code is between 0 and 255 other data types.

B

CHAR_LENGTH(number)

Length of the value in value expression. (Same as CHARACTER_LENGTH.)

B

CHARACTER_LENGTH (number)

Length of the value in value expression. (Same as CHAR_LENGTH.)

B

COALESCE(datatype)

Substitutes a value for a null value. (Same as VALUE.)

B

CONCAT(string1, string2)

Character string formed by appending string2 to string1; if a string is null, the result is DBMS-dependent

B

CONVERT(value, SQLtype)

Value converted to SQLtype, where SQLtype can be any valid SQL data type.

U

COS(float)

Cosine of float radians

U

COSH(float)

Hyperbolic cosine of float radians

U

COT(float)

Cotangent of float radians

B

CURDATE()

The current date as a date value

B

CURTIME()

The current local time as a time value

B

DATABASE()

Current database

B

DATE(date)

Obtains the date from the value in value expression

B

DAY(date)

An integer from 1 to 41 representing the day of the month in date(Same as DAYOFMONTH.)

U

DAYNAME(date)

A character string representing the day component of date; the name for the day is specific to the data source

B

DAYOFMONTH(date)

An integer from 1 to 41 representing the day of the month in date (Same as DAY.)

U

DAYOFWEEK(date)

An integer from 1 to 7 representing the day of the week in date; 1 represents Sunday

U

DAYOFYEAR(date)

An integer from 1 to 366 representing the day of the year in date

B

DAYS(date)

An integer representation of the date in value expression

B

DECIMAL(number, precision, scale)

Decimal representation of the value in value expression.

U

DEGREES(number)

Degrees in number radians

B

DIGITS(number)

Character string representation of the value in value expression.

U

EXP(float)

Exponential function of float

B

FLOAT(float)

Floating point representation of the value in value expression.

U

FLOOR(number)

Largest integer less than or equal to number

B

HEX(string)

Hexadecimal representation of the value in value expression.

B

HOUR(time)

An integer from 0 to 23 representing the hour component of time

B

IFNULL(expression, value)

Value if expression is null; expression if not null

U

INSERT(string1, start, length, string2)

A character string formed by deleting length characters from string1 beginning at start, and inserting string2 into string1 at start.

B

INTEGER(number)

Integer representation of the value in value expression

B

LCASE(string)

Converts all uppercase characters in string to lowercase. (Same as LOWER.)

B

LEFT(string, count)

The count leftmost characters from string

B

LENGTH(string)

Number of characters in string, excluding trailing blanks

B

LOCATE(string1, string2[,start])

Position in string2 of the first occurrence of string1, searching from the beginning of string2; if start is specified, the search begins from position start 0 is returned if string2 does not contain string1 Position 1 is the first character in string2.

U

LOG(float)

Base e logarithm of float

U

LOG10(float)

Base 10 logarithm of float

B

LOWER(string)

Converts all uppercase characters in string to lowercase. (Same as LCASE.)

B

LTRIM(string)

Characters of string with leading blank spaces removed

B

MICROSECOND (timestamp)

Obtains the microsecond part of the value in value-expression.

B

MINUTE(time)

An integer from 0 to 59 representing the minute component of time

U

MOD(integer1, integer2)

Remainder for integer1/integer2

B

MONTH(date)

An integer from 1 to 12 representing the month component of date

U

MONTHNAME(date)

A character string representing the month component of date; the name for the month is specific to the data source

B

NOW()

A timestamp value representing the current date and time

B

OCTET_LENGTH(number)

Obtains the length in bytes of the value in value-expression.

U

PI()

The constant pi

B

POSITION(string1, string2[,start])

Position in string2 of the first occurrence of string1, searching from the beginning of string2; if start is specified, the search begins from position start 0 is returned if string2 does not contain string1 Position 1 is the first character in string2.

U

POWER(number, power)

Number raised to (integer) power

B

PROFILE(string)

Obtains the value associated with an attribute of the current user session.

U

QUARTER(date)

An integer from 1 to 4 representing the quarter in date; 1 represents January 1 through March 31

U

RADIANS(number)

Radians in number degrees

U

RAND(integer)

Random floating point for seed integer

U

REPEAT(string, count)

A character string formed by repeating string count times

U

REPLACE(string1, string2, string3)

Replaces all occurrences of string2 in string1 with string3

U

RIGHT(string, count)

The count rightmost characters in string

U

ROUND(number, places)

Number rounded to places places

B

RTRIM(string)

The characters of string with no trailing blanks

B

SECOND(time)

An integer from 0 to 59 representing the second component of time

U

SIGN(number)

 

-1 to indicate number is less than 0

0 to indicate number is equal to 0

1 to indicate number is greater than 0

U

SIN(float)

Sine of float radians

U

SINH(float)

Hyperbolic sine of float radians

U

SPACE(count)

A character string consisting of count spaces

U

SQRT(float)

Square root of float

B

SUBSTR(string, start, length)

A character string formed by extracting length characters from string beginning at start

B

SUBSTRING(string, FROM start, FOR length)

A character string formed by extracting length characters from string beginning at start

U

TAN(float)

Tangent of float radians

U

TANH(float)

Hyperbolic tangent of float radians

B

TIME(time)

Obtains time from the value in value expression

B

TIMESTAMP(string1, string2)

Obtains timestamp from a value or pair of values

B

TRIM(orientation, string)

Removes leading and/or trailing pad characters from CHARACTER or VARCHAR value expressions

U

TRUNCATE(number, places)

Number truncated to places places

B

UCASE(string)

Converts all lowercase characters in string to uppercase. (Same as UPPER.)

B

UPPER(string)

Converts all lowercase characters in string to uppercase. (Same as UCASE.)

B

USER()

Current user

B

VALUE(datatype)

Substitutes a value for a null value. (Same as COALESCE.)

B

VARGRAPHIC(string)

Obtains graphic string representation of a character string

U

WEEK(date)

An integer from 1 to 53 representing the week of the year in date

B

YEAR(date)

An integer representing the year component of date