escape

Syntax

result = ESCAPE(text)

Arguments

result, text: text

Meaning

This function doubles any backslashes in the text provided between brackets. Instead of a text variable you can also provide a literal string between single quotes or a database tag (possibly including occurrence number). Forward slashes are left alone.

In general, "escaping" a character (by doubling it or by placing some other specific character in front of it, is common practice in programming languages where certain characters have a programmatic meaning and therefore when the programmer wants to use such a character in a literal way, he or she has to indicate somehow that the interpreter or compiler should ignore the relevant character. this is what escaping is for. In ADAPL, escaping is needed if you want to display a string containing backslashes on screen via an ERRORM command: without escaping the entire string, ERRORM displays the string without any backslashes.

Note that a string containing backslashes should not be escaped when you put it in a text variable, because you might want to do some operations on the original string. Only when you want to display the contents of this text variable through ERRORM, you should escape it.

Examples

errorm escape('\\ourserver\axiell\images')

Result

The result of the escape function becomes \\\\ourserver\\axiell\\images. Displayed with errorm, the user sees the text \\ourserver\axiell\images.