Published on

REVERSE

How to use COBOL REVERSE string function

WORKING-STORAGE SECTION.
01 WS-STRING PIC X(8) VALUE 'LET ME  '.

PROCEDURE DIVISION.
    DISPLAY 'WS-STRING = ' '|' WS-STRING '|'
    MOVE FUNCTION REVERSE(WS-STRING) TO WS-STRING
    DISPLAY 'WS-STRING = ' '|' WS-STRING '|'
    GOBACK.

SYSOUT Result

WS-STRING = |LET ME  |
WS-STRING = |  EM TEL|