Tracing cases of failure got

Discussão em 'StackOverflow' iniciado por fdantas, Setembro 2, 2020.

  1. fdantas

    fdantas Administrator Moderador

    I'm trying to populate an integer variable from a character variable. If there is any error found I want to show the error message and trace all the possible cases for failure got.

    //Defining variable

    Define variable char_value as character no-undo initial "kk".

    Define variable int_value as integer no-undo.

    define variable ix as integer no-undo.

    Assign int_value = integer(char_value) no-error.

    IF ERROR-STATUS:ERROR OR ERROR-STATUS:NUM-MESSAGES > 0 THEN
    DO:

    MESSAGE ERROR-STATUS:NUM-MESSAGES
    " errors occurred during conversion." SKIP
    "Do you want to view them?"
    VIEW-AS ALERT-BOX QUESTION BUTTONS YES-NO

    UPDATE view-errs AS LOGICAL.

    IF view-errs THEN
    DO ix = 1 TO ERROR-STATUS:NUM-MESSAGES:

    MESSAGE ERROR-
    STATUS:GET-NUMBER(ix)
    ERROR-STATUS:GET-
    MESSAGE(ix).
    END.
    END.


    There are two conditions which I want to know.

    1. What char value I gave so that no. Of error returns will be more than 1.
    2. How can I trace all the possible cases for failure got.

    Continue reading...

Compartilhe esta Página