Hi! the below code moves a pic x(35) to a pic 9(12), as I understand the pic x is then converted to pic 9-format when the data is moved.
The moved data consists of a couple of numbers but the last part is a character in this case a "-". But then the "-" should be converted to
a numeric representation, yes?
However as you can see below it checks if the position in the pic 9-parameter is not numeric, but it should be numeric since it was converted and stored in pic 9-parameter?
The code is below:
MOVE WP51I-VALFRI-TEXT(21:12) TO WS-PAYMENT-AMT
EVALUATE TRUE
WHEN WS-PAYMENT-AMT(12:1) IS NUMERIC
SET NUMERIC-FLAG TO TRUE
CONTINUE
WHEN WS-PAYMENT-AMT(12:1) = '-'
MOVE '0' TO WS-PAYMENT-AMT(12:1)
Cheers
Harald
WORKING-STORAGE SECTION.
01 WS-FILLER.
05 WS-SOURCE PIC X(35) VALUE
'ABCDEFGHIJKLMNOPQRSTUVWXYZ---------'.
05 WS-DEST PIC 9(12).
PROCEDURE DIVISION.
MOVE WS-SOURCE TO WS-DEST.
DISPLAY 'SOURCE >' WS-SOURCE '<'.
DISPLAY 'DEST >' WS-DEST '<'.
STOP RUN.