7 6 The Simplest Type of Prompt Key Processing

LANSA Application Design

7.6 The Simplest Type of Prompt Key Processing

The simplest types of prompt key processing programs are the ones that display a list of values to the user.

The previous example that handled department number prompts would probably look like this (it does not use page at a time techniques because there are only 20 or so departments):

   << define browse list and exchange list >>

 

        DEF_LIST  NAME(#DEPTS) FIELDS(#DEPTNO #DEPTDESC)

                  SEL_ENTRY(#CURSORSEL)

        EXCHANGE  FIELDS(#DEPTS) OPTION(*ALWAYS)

 

  << clear list and place details of all departments into it  >>

 

        CLR_LIST  NAMED(#DEPTS)

        SELECT    FIELDS(#DEPTS) FROM_FILE(DEPTFILE)

        ADD_ENTRY TO_LIST(#DEPTS)

        ENDSELECT

 

  << Display list in pop-up window until user selects or cancels >>

 

        CHANGE    FIELDS(#DEPTS) TO(*NULL)

        DOUNTIL   COND('#CURSORSEL *GT 0')

        POP_UP    BROWSELIST(#DEPTS) CURSOR_LOC(*ATFIELD #DEPTNO)

                  EXIT_KEY(*NO) MENU_KEY(*YES *RETURN)

        IF       COND('#CURSORSEL *GT 0')

        GET_ENTRY NUMBER(#CURSORSEL) FROM_LIST(#DEPTS)

        ENDIF

        ENDUNTIL

        RETURN