4.5.2 Changes Required to Restructure for WEBEVENT
For this function to be re-written using the FUNCTION OPTIONS(*WEBEVENT) style, the following changes must be made:
- REQUEST must be the last statement executed in the function, so the commands must be reorganized.
- The MENU_KEY is not allowed in the REQUEST statement.
- BEGIN_LOOP and END_LOOP must be removed and replaced by statements to determine if the function is executing for the first time.
The overall changes required are shown below.
FUNCTION OPTIONS(*DIRECT *WEBEVENT)
GROUP_BY NAME(#PANEL) FIELDS(#EMPNO #SURNAME...)
If the function has data to be inserted...
INSERT FIELDS(#PANEL) TO_FILE(PSLMST) VAL_ERROR(...)
MESSAGE MSGID(DCU0011) MSGF(DC@M01) MSGDTA('employee')
CHANGE FIELD(#PANEL) TO(*NULL)
End of the If logic.
REQUEST FIELDS(#PANEL) DESIGN(*DOWN) IDENTIFY(*DESC)
In order to determine if the function is executing for the first time or if it has data to be inserted, you need to use a variable to determine the state of the function. Refer to 4.5.3 Handling Re-entrant Functions.