*TRANSLATE - Translate to Lower/Upper Case Characters

#### Search Results

Search

# *TRANSLATE - Translate to Lower/Upper Case Characters

`*TRANSLATE` `(`operand | , |  | `LOWER` |  | `)`
`UPPER`

Format/length: same as operand.

This document covers the following topics:

- Function

- Restrictions

- Syntax Description

- Example

## Function

The Natural system function `*TRANSLATE` converts the characters of an alphanumerical or binary operand to upper case or lower case. The content of the operand is not modified.

`*TRANSLATE` may be specified as an operand in any position of a statement wherever an operand of format A, U or B is allowed.

## Restrictions

When using the system function `*TRANSLATE`, the following restrictions apply:

- `*TRANSLATE` must not be used where a target variable is expected.

- You may not nest `*TRANSLATE` in a system function.

## Syntax Description

Operand Definition Table:

Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition
--- | --- | --- | --- | ---
`operand` | C | S | A |  |  | A | U | B |  |  |  |  |  |  |  |  |  |  | yes | no

Syntax Element Description:

Syntax Element | Description
--- | ---
`*TRANSLATE (operand,LOWER)` | Lower Case Translation When the keyword `LOWER` is used as a second argument, the character string in operand is translated to lower case.
`*TRANSLATE (operand,UPPER)` | Upper Case Translation When the keyword `UPPER` is used as a second argument, the character string in operand is translated to upper case.

## Example

    DEFINE DATA LOCAL
    1 #SRC  (A)DYNAMIC INIT <'aBcDeFg !§$%&/()=?'>
    1 #DEST (A)DYNAMIC
    END-DEFINE
    *
    PRINT 'Source string to be translated..........:' #SRC
    *
    MOVE *TRANSLATE(#SRC, UPPER) TO #DEST
    PRINT 'Source string translated into upper case:' #DEST
    *
    MOVE *TRANSLATE(#SRC, LOWER) TO #DEST
    PRINT 'Source string translated into lower case:' #DEST
    END

Output:

    Source string to be translated..........: aBcDeFg !§$%&/()=?

    Source string translated into upper case: ABCDEFG !§$%&/()=?

    Source string translated into lower case: abcdefg !§$%&/()=?

### On this page

- Function
- Restrictions
- Syntax Description
- Example