ENCODE function

Encodes a source character string and returns the encoded character string result.

Syntax

ENCODE ( expression )
expression
An expression that results in a character string value. If you use a constant, you must enclose it in quotation marks (" ").

Example

This procedure uses the ENCODE function to disguise a password that the user enters, and then displays the encoded password:

r-encode.p

DEFINE VARIABLE password      AS CHARACTER NO-UNDO FORMAT "x(16)".
DEFINE VARIABLE id            AS CHARACTER NO-UNDO FORMAT "x(12)".
DEFINE VARIABLE n-coded-p-wrd AS CHARACTER NO-UNDO FORMAT "x(16)".

SET id LABEL "Enter user id" password LABEL
  "Enter password" BLANK WITH CENTERED SIDE-LABELS.

n-coded-p-wrd = ENCODE(password).

DISPLAY n-coded-p-wrd LABEL "Encoded password".

Notes