IBM 15 Switch User Manual


 
135
CLEM Language Reference
Conversion Functions
Conversion functions allow you to construct new elds and convert the storage type of existing
les. For example, you can form new strings by joining strings together or by taking strings apar t.
To join two st
rings, use the operator ><. For example, if the eld Site has the value "BRAMLEY",
then "xx" >< Site returns "xxBRAMLEY". The result of >< is always a string, even if the arguments are
not strings. Thus, if eld V1 is 3 and eld V2 is 5, then V1 >< V2 returns "35" (a strin g, not a numb er).
Conversion f
unctions (and any other functions that require a specic type of input, such as a
date or time value) depend on the current formats specied in the Stream Options dialog box.
For example, if you want to convert a string eld with values Jan 2003, Feb 2003, and so on,
select the ma
tching date format MON YYYY as the de f ault date format for the stream. For more
informa tion, see the topic Setting general op tions for strea ms in Chapter 5 on p. 5 5.
Function
Result
Descriptio
n
ITEM1 >< ITEM2
String
Concatenates values fo r two elds and returns the resulting
string as ITEM1ITEM2.
to_integer(ITEM)
Integer
Converts the storage of the specied eld to an integer.
to_real(ITEM)
Real Converts t
he storage of the specied eld to a real.
to_number(ITEM)
Number Converts the storage of the specied eld to a number.
to_string(ITEM)
String
Converts the storage of the specied eld to a string.
to_time(ITEM)
Time
Converts the storage of the specied eld to a time.
to_date(ITEM)
Date
Converts the storage of the specied eld to a date.
to_timestamp(ITEM)
Timestamp
Converts the storage of the specied eld to a timestamp.
to_datetime(ITEM)
Datetime
Converts the storage of the specied eld to a date, time,
or timestamp value.
datetime_date(ITEM)
Date
Returns the date value for a number, string, or timestamp.
Note this is the only function that allows you to convert a
number (in seconds) back to a date. If ITEM is a string,
creates a date by parsi ng a string in the current date format.
The date format specied in the stream properties dialog
box must be correct for this function to be successful. If
ITEM is a number, it is interpreted as a number of seconds
since the base date (or epoch). F ractions of a day are
truncated. If ITEM is a timestamp, the date part of the
timestamp is returned. If ITEM is a date, it is returned
unchanged.
Comparison Functions
Compa r is on functions a r e used to compare eld values to each other or to a specied string. For
example, you can check strings for equality using =. An example of string equality verication
is: Class = "class 1".
For purposes of numeric comparison, greater means closer to positive innity, and lesser
means closer to negative innity. Th at i s, all negative numbers are less than any positive number.
Function
Result
Description
count_equal(ITEM1, LIST)
Integer
Returns the number of values from a list of elds that
are equal to ITEM1 or null if ITEM1 is null. For more
information, see the topic Summarizing Multiple Fields in
Chapter 7 on p. 115.