Step 1. Review Procedural Logic
In this step, you will review the RDML logic of procedural functions and you will redesign the function as two WEBEVENT functions. Each WEBEVENT function will have just one display statement. For more details, refer to How Is WEBEVENT Different?
1. Following is a sample of the code which is produced by the FRENQ02 template using the DEPTAB and SECTAB files:
FUNCTION OPTIONS(*NOMESSAGES *DEFERWRITE *DIRECT)
GROUP_BY NAME(#HEADER) FIELDS(#DEPTMENT #DEPTDESC)
DEF_LIST NAME(#iiiLIST) FIELDS((#LISTDUMMY *HIDDEN) #SECTION #SECDESC #SECPHBUS)
********** COMMENT(Loop until user EXITs or CANCELs)
BEGIN_LOOP
R10: REQUEST FIELDS(#DEPTMENT) DESIGN(*DOWN) IDENTIFY(*DESC)
********** COMMENT(Fetch file DEPTAB details )
FETCH FIELDS(#HEADER) FROM_FILE(DEPTAB) WITH_KEY(#DEPTMENT) NOT_FOUND(R10) ISSUE_MSG(*YES)
********** COMMENT(Select all file SECTAB details)
SELECT FIELDS(#iiiLIST) FROM_FILE(SECTAB) WITH_KEY(#DEPTMENT)
ADD_ENTRY TO_LIST(#iiiLIST)
ENDSELECT
********** COMMENT(Display results to the user)
DISPLAY FIELDS(#HEADER) DESIGN(*DOWN) IDENTIFY(*DESC) BROWSELIST(#iiiLIST)
********** COMMENT(Clear header and list and loop around )
CHANGE FIELD(#HEADER) TO(*DEFAULT)
CLR_LIST NAMED(#iiiLIST)
END_LOOP
Notes: You will use a list name of #iiiLIST, where iii=your initials.
2. Redesign this function using two WEBEVNT functions. For an example, refer to How Does WEBEVENT Work? (Solutions are provided in Step 2.)