IBM 15 Switch User Manual


 
151
CLEM Language Reference
Sequence functions
Record indexing
Averaging, su mming, and comparing values
Monitoring change—differentiation
@SINCE
Offset values
Additi onal sequence facilities
For many applications, each record passing through a stream can be considered as an individual
case, independent of all others. In such situ ations, the order of records is usually unimportant.
For some classes of problems, however, the re cord sequence is very importan t. T hese are
typically time series situations, in which the sequence of records repres ents an or dered sequence
of e vents or occurrences. Each record represents a snapshot at a particular instant in time; much
of the richest information, however, might be contained not in instantaneous values but in the
way in which such values are changing and behaving over time.
Of course, the relevant parameter may be something other than time. For example, the records
could represent analyses performed at distances along a line, but the same p r incipl es would apply.
Sequence and special functions are immediately re cognizable by the following characteristics:
They are all prexed by @.
Their names are given in upper case.
Sequence function s can r efer to the record currently being processed by a node, the records that
have already passed through a node, and even, in on e case, records that have yet to pass through
a node. Sequence functions can be mixed freely with other components of CLEM expressions,
although some have res triction s on what can be used as their arguments.
Examples
You may nd it u seful to know how long it has been since a certain event occurred or a condition
was true. Use the functi on @SINCE to do this—for example:
@SINCE(Income > Outgoings)
This function returns the offset of the last record where this condition was true—that is, the
number of records before this one in which the cond ition was tru e. If the condition has never been
true, @SINCE returns @INDEX + 1.
Sometimes you may want to refer to a value of the current record in the expression used by
@SINCE. You can do th is using the functio n @THIS, which species that a eld name always
applies to the current record. To nd the offset of the last record that had a Concentration eld
value more than twice that of the current record, you could use:
@SINCE(Concentration > 2 * @THIS(Concentration))
In some cases the condition given to @SINCE is true of the current record by denition—for
example:
@SINCE(ID == @THIS(ID))