1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

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

Discussão em 'StackOverflow' iniciado por fdantas, Setembro 25, 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