Step 5 Re entrant WEBEVENT Function

LANSA Web Functions

Step 5. Re-entrant WEBEVENT Function

In this step, you will create a single re-entrant WEBEVENT function to perform the same operations as the iiiFN5 and iiiFN6 functions.

1.  Working with your iiiPROC03 process, create a new function named iiiFN7 Display Sections in Department. You will manually enter the code for the function.

2.  Write the RDML code as a re-entrant WEBEVENT function so that it requests a Department Code and then displays the Sections in the Department. For more details, refer to Handling Re-entrant Functions.

3.  Compile your function.

4.  Remember to register the keywords for the function. In this case, the function links back to itself.

5.  Test your function.

Solution

This is one possible solution to this exercise:

FUNCTION   OPTIONS(*DIRECT *WEBEVENT)
DEFINE     FIELD(#RENTRY) TYPE(*CHAR) LENGTH(1) DEFAULT(*BLANK)
GROUP_BY   NAME(#HEADER) FIELDS((#DEPTMENT) (#DEPTDESC) (#RENTRY *HIDDEN))
DEF_LIST   NAME(#iiiLIST) FIELDS((#LISTDUMMY *HIDDEN) #SECTION #SECDESC #SECPHBUS)
IF         COND('#RENTRY *NE Y')
CHANGE     FIELD(#HEADER) TO(*DEFAULT)
CHANGE     FIELD(#RENTRY) TO(Y)
REQUEST    FIELDS((#DEPTMENT) (#RENTRY *HIDDEN)) DESIGN(*DOWN) IDENTIFY(*DESC) MENU_KEY(*NO) EXIT_KEY(*NO) USER_KEYS((01 SEARCH))
ELSE      
CLR_LIST   NAMED(#iiiLIST)
**********  COMMENT(Fetch file DEPTAB details )
FETCH      FIELDS(#HEADER) FROM_FILE(DEPTAB) WITH_KEY(#DEPTMENT) NOT_FOUND(R10) ISSUE_MSG(*YES)
**********  COMMENT(Select the SECTAB file details)
SELECT     FIELDS(#iiiLIST) FROM_FILE(SECTAB) WITH_KEY(#DEPTMENT)
ADD_ENTRY  TO_LIST(#iiiLIST)
ENDSELECT 
**********  COMMENT(Display results to the user)
R10: CHANGE     FIELD(#RENTRY) TO(*BLANK)
DISPLAY    FIELDS(#HEADER) DESIGN(*DOWN) IDENTIFY(*DESC) BROWSELIST(#iiiLIST) MENU_KEY(*NO) EXIT_KEY(*NO) USER_KEYS((01 RETURN))
ENDIF

 

  

The keyword entries are:

Process

iiiPROC03

Function

iiiFN7

Keyword

SEARCH

Description

Search

Linked Process

iiiPROC03

Linked Function

iiiFN7

 

 

Process

iiiPROC03

Function

iiiFN7

Keyword

RETURN

Description

New Search

Linked Process

iiiPROC03

Linked Function

iiiFN7