From my understanding when using UNSTRING
, the use of ON OVERFLOW [INSTRUCTION]
will be useful if there would be an overflow in the use of the UNSTRING
.
But if there is no overflow, why would you use NOT ON OVERFLOW [INSTRUCTION]
?
The only possible utility to the NOT ON OVERFLOW [INSTRUCTION]
would be to pass an instruction if there is no overflow but what would be the use of that if you already had the expected result from the UNSTRING
?
Is there any concrete example of how this could be useful in this example :
IDENTIFICATION DIVISION.
PROGRAM-ID. YOUR-PROGRAM-NAME.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 WS-VAR1 PIC A(11) VALUE "Hello World".
01 WS-VAR2 PIC A(5).
01 WS-VAR3 PIC A(5).
01 WS-COMPTEUR PIC 9 VALUE 2.
PROCEDURE DIVISION.
MAIN-PROCEDURE.
INTO WS-VAR2 WS-VAR3
WITH POINTER WS-COMPTEUR
ON OVERFLOW DISPLAY "This string is too large"
END-UNSTRING.
DISPLAY WS-VAR2
DISPLAY WS-VAR3.
STOP RUN.
END PROGRAM YOUR-PROGRAM-NAME.
Even when I read IBM documentation, it doesn't give me much explanation as to what could be used in this instance but to display a message ?
IBM Documentation : link