KBML Functions
The following functions are available in actions.
- formatTimestamp
- Retrieves the timestamp as a UNIX time (number), patterns
it as a string, and returns a formatted timestamp. The pattern is defined by the Java™ class SimpleDateFormat (the pattern definition can be found
here https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html). For example:
$ {formatTimestamp(event.lastUpdateTimestamp, "yyyy-MM-dd HH:mm:ss")}
- getSqlText
- Retrieves SQL text for both static and dynamic SQL. For Static SQL, a catalog query is
performed; for dynamic SQL, the information is present in the event. Enables you
to create a single action that works for both static and dynamic SQL and
provides you the text in both cases. This enables you to avoid duplicate actions
for dynamic and static SQL. For
example:
${getSqlText(event)}
If the event is not the right kind to provide SQL text, the following message will be returned by the function:
No text: Cannot get SQL Text for events of type "{0}"
{0} will be substituted with the type of the event in question.
Note: For static text, the action does a catalog query but to avoid a flood of alerts (which could cause excessive workload for the CAE Agent and Server), only 10 static SQLTEXTS per minute for a given Db2 are acquired. - wordWrapSQLForBatch
- Word wrap long text strings for use in submitting JCL. Will wrap at any non-identifier
character. Identifier characters are defined as letters, digits, underscore,
single quote, and double quote. If an identifier is longer that 72 characters,
the identifier will wrap with a character in the 72nd column. Takes a String as
an argument and returns a word-wrapped String. For
example:
${wordWrapSQLForBatch(getSqlText(event))}