how to use entry and lookup function in the same program to display the string corresponding...

Discussão em 'StackOverflow' iniciado por fdantas, Fevereiro 3, 2017.

  1. fdantas

    fdantas Administrator Moderador

    when i enter 4 at the runtime ,the following program should return me the string"four" and similarly the string`s corresponding to 5,6,7 and 8.

    this should be done using entry function.

    DEFINE VARIABLE x AS CHARACTER NO-UNDO FORMAT "9" LABEL "Enter a digit between 4 and 8".
    DEFINE VARIABLE show AS CHARACTER NO-UNDO FORMAT "x(5)" EXTENT 5 LABEL "Literal" INITIAL ["four","five","six","seven","eight"].
    define variable i as integer .

    REPEAT:
    SET x AUTO-RETURN.

    i = lookup(x, "4,5,6,7,8",",") .
    IF i = 0
    THEN
    DO:
    MESSAGE "Digit must be 4,5,6,7, or 8. Try again.".
    UNDO, RETRY.
    END.

    MESSAGE entry(i,show,",")
    VIEW-AS ALERT-BOX INFO BUTTONS OK.

    END.

    Continue reading...

Compartilhe esta Página