Function SET011B: Populate Browselists Used in Menu
FUNCTION OPTIONS(*DIRECT *WEBEVENT) RCV_LIST(#DATALISTW );
********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_011);
********** COMMENT(Function .......: SET011B);
********** COMMENT(Created on .....: 20/02/00);
********** COMMENT();
********** COMMENT(Full Description: This function populates three);
********** COMMENT(browselists. The data in the browselists will be used);
********** COMMENT(to build the expandable menu.);
********** COMMENT();
********** COMMENT(Disclaimer: The following material is supplied as an);
********** COMMENT(example only. No warranty is expressed or implied.);
********** COMMENT();
********** COMMENT(Group and field definitions);
********** COMMENT();
DEFINE FIELD(#SELT_DEPT) REFFLD(#DEPTMENT);
DEFINE FIELD(#SELT_SECT) REFFLD(#SECTION);
DEFINE FIELD(#MODE) TYPE(*CHAR) LENGTH(001) DECIMALS(0);
DEFINE FIELD(#MENUFLG) TYPE(*CHAR) LENGTH(005) DECIMALS(0) INPUT_ATR(LC);
DEFINE FIELD(#COUNTER) TYPE(*DEC) LENGTH(005) DECIMALS(0);
DEFINE FIELD(#S_011MCMP) TYPE(*CHAR) LENGTH(014) DECIMALS(0);
********** COMMENT();
GROUP_BY NAME(#PANELDATA) FIELDS((#SELT_DEPT *HIDDEN)(#SELT_SECT *HIDDEN)(#MODE *HIDDEN));
********** COMMENT(Browselist containing the TREE menu options.);
DEF_LIST NAME(#S_011MTRE) FIELDS((#S_011MCMP *OUTPUT)(#S_011MNUM *HIDDEN)(#S_011MDES *HIDDEN)(#S_011MTYP *HIDDEN)(#DEPTMENT *HIDDEN)(#SECTION *HIDDEN)(#S_011MCOL *HIDDEN)(#MENUFLG *HIDDEN));
********** COMMENT(Browselist containing the menu Styles.);
DEF_LIST NAME(#S_011MSTY) FIELDS((#S_011MCMP *OUTPUT)(#COUNTER *HIDDEN));
********** COMMENT(This browselist is only needed so that this example);
********** COMMENT(can also be executed with Internet Explorer.);
DEF_LIST NAME(#S_011MDIV) FIELDS((#S_011MCMP *OUTPUT)(#COUNTER *HIDDEN));
********** COMMENT(Browselist coming from SET011A with the menu and);
********** COMMENT(submenu descriptions.);
DEF_LIST NAME(#DATALISTW) FIELDS((#S_011MNUM)(#S_011MDES)(#S_011MTYP)(#S_011MCOL)(#S_011MFLG)(#DEPTMENT)(#SECTION)) TYPE(*WORKING) ENTRYS(0009999);
********** COMMENT(Build the menu options only the first time invoked);
IF COND('#mode *ne Y');
CHANGE FIELD(#MODE) TO(Y);
EXECUTE SUBROUTINE(BLD_MENU);
GOTO LABEL(REQ);
ENDIF;
********** COMMENT();
REQ: REQUEST FIELDS(#PANELDATA) BROWSELIST(#S_011MTRE) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO);
********** COMMENT(Dummy DISPLAY to cause the browselist to be sent to);
********** COMMENT(the browser.);
IF COND('1 *EQ 2');
DISPLAY BROWSELIST(#S_011MSTY) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO);
ENDIF;
********** COMMENT(Dummy DISPLAY to cause the browselist to be sent to);
********** COMMENT(the browser.);
IF COND('1 *EQ 2');
DISPLAY BROWSELIST(#S_011MDIV) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO);
ENDIF;
********** COMMENT(*******************************************************);
********** COMMENT(Subroutine ....: BLD_MENU);
********** COMMENT(Description....: Build Tree Menu);
********** COMMENT(*******************************************************);
SUBROUTINE NAME(BLD_MENU);
********** COMMENT(*******************************************************);
DEFINE FIELD(#PREV_MNUM) REFFLD(#S_011MNUM) DEFAULT(0);
CLR_LIST NAMED(#S_011MTRE);
********** COMMENT(Create Menu Array);
CHANGE FIELD(#S_011MCMP) TO(S_011CREATEMNU);
ADD_ENTRY TO_LIST(#S_011MTRE);
********** COMMENT(S_011MTYP = 'M' (menu) and for each one of those, its);
********** COMMENT(submenu options (S_011MTYP = 'S').);
SELECTLIST NAMED(#DATALISTW);
********** COMMENT(Create Sub Item Array for each sub item group. Menu and);
********** COMMENT(Sub Menu items are grouped together by S_011MNUM. A);
********** COMMENT(number different than the previous one indicates the);
********** COMMENT(the entry is a Menu, otherwise it is a submenu of the);
********** COMMENT(current menu.);
IF COND('#PREV_MNUM *ne #S_011MNUM');
CHANGE FIELD(#PREV_MNUM) TO(#S_011MNUM);
EXECUTE SUBROUTINE(TYPEMLOGIC);
ELSE;
EXECUTE SUBROUTINE(TYPESLOGIC);
ENDIF;
********** COMMENT();
ENDSELECT;
********** COMMENT(Build Main Menu Items);
SELECTLIST NAMED(#DATALISTW) WHERE('#S_011MTYP = M');
CHANGE FIELD(#S_011MCMP) TO(S_011ADDMNULST);
ADD_ENTRY TO_LIST(#S_011MTRE);
ENDSELECT;
********** COMMENT(Initialse and build the entire menu);
CHANGE FIELD(#S_011MCMP) TO(S_011BUILDMNU);
ADD_ENTRY TO_LIST(#S_011MTRE);
********** COMMENT(Build STYLES and DIV Browselists);
EXECUTE SUBROUTINE(BLD_STYDIV);
ENDROUTINE;
********** COMMENT(=======================================================);
********** COMMENT(Subroutine ....: TYPEMLOGIC);
********** COMMENT(Description....: Process Type 'M' entries. Build all);
********** COMMENT(Menu Sub Items.);
********** COMMENT(=======================================================);
SUBROUTINE NAME(TYPEMLOGIC);
********** COMMENT(Determine whether to present the menu item initially);
********** COMMENT(expanded depending on the value of S_011MFLG.);
IF COND('#S_011MFLG *EQ E');
CHANGE FIELD(#MENUFLG) TO('''true''');
ELSE;
CHANGE FIELD(#MENUFLG) TO('''false''');
ENDIF;
CHANGE FIELD(#S_011MCMP) TO(S_011CREATESUB);
ADD_ENTRY TO_LIST(#S_011MTRE);
ENDROUTINE;
********** COMMENT(=======================================================);
********** COMMENT(Subroutine ....: TYPESLOGIC);
********** COMMENT(Description....: Process Type 'S' entries);
********** COMMENT(=======================================================);
SUBROUTINE NAME(TYPESLOGIC);
********** COMMENT(Add all Sub Items for each Sub item group.);
IF COND('#S_011MCOL *EQ *BLANK');
CHANGE FIELD(#S_011MCOL) TO('''#FFFFFF''');
ENDIF;
CHANGE FIELD(#S_011MCMP) TO(S_011ADDSUBITM);
ADD_ENTRY TO_LIST(#S_011MTRE);
ENDROUTINE;
********** COMMENT(=======================================================);
********** COMMENT(Subroutine ....: BLD_STYDIV);
********** COMMENT(Description....: Build STYLES and DIV Browselist (for);
********** COMMENT(Internet Explorer));
********** COMMENT(=======================================================);
SUBROUTINE NAME(BLD_STYDIV);
CLR_LIST NAMED(#S_011MSTY);
CLR_LIST NAMED(#S_011MDIV);
CHANGE FIELD(#COUNTER) TO(*ZEROS);
SELECTLIST NAMED(#DATALISTW);
CHANGE FIELD(#COUNTER) TO('#COUNTER + 1');
CHANGE FIELD(#S_011MCMP) TO(S_011MSTY);
ADD_ENTRY TO_LIST(#S_011MSTY);
CHANGE FIELD(#S_011MCMP) TO(S_011MDIV);
ADD_ENTRY TO_LIST(#S_011MDIV);
ENDSELECT;
ENDROUTINE;
FUNCTION OPTIONS(*DIRECT *WEBEVENT) RCV_LIST(#DATALISTW );
********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_011);
********** COMMENT(Function .......: SET011B);
********** COMMENT(Created on .....: 20/02/00);
********** COMMENT();
********** COMMENT(Full Description: This function populates three);
********** COMMENT(browselists. The data in the browselists will be used);
********** COMMENT(to build the expandable menu.);
********** COMMENT();
********** COMMENT(Disclaimer: The following material is supplied as an);
********** COMMENT(example only. No warranty is expressed or implied.);
********** COMMENT();
********** COMMENT(Group and field definitions);
********** COMMENT();
DEFINE FIELD(#SELT_DEPT) REFFLD(#DEPTMENT);
DEFINE FIELD(#SELT_SECT) REFFLD(#SECTION);
DEFINE FIELD(#MODE) TYPE(*CHAR) LENGTH(001) DECIMALS(0);
DEFINE FIELD(#MENUFLG) TYPE(*CHAR) LENGTH(005) DECIMALS(0) INPUT_ATR(LC);
DEFINE FIELD(#COUNTER) TYPE(*DEC) LENGTH(005) DECIMALS(0);
DEFINE FIELD(#S_011MCMP) TYPE(*CHAR) LENGTH(014) DECIMALS(0);
********** COMMENT();
GROUP_BY NAME(#PANELDATA) FIELDS((#SELT_DEPT *HIDDEN)(#SELT_SECT *HIDDEN)(#MODE *HIDDEN));
********** COMMENT(Browselist containing the TREE menu options.);
DEF_LIST NAME(#S_011MTRE) FIELDS((#S_011MCMP *OUTPUT)(#S_011MNUM *HIDDEN)(#S_011MDES *HIDDEN)(#S_011MTYP *HIDDEN)(#DEPTMENT *HIDDEN)(#SECTION *HIDDEN)(#S_011MCOL *HIDDEN)(#MENUFLG *HIDDEN));
********** COMMENT(Browselist containing the menu Styles.);
DEF_LIST NAME(#S_011MSTY) FIELDS((#S_011MCMP *OUTPUT)(#COUNTER *HIDDEN));
********** COMMENT(This browselist is only needed so that this example);
********** COMMENT(can also be executed with Internet Explorer.);
DEF_LIST NAME(#S_011MDIV) FIELDS((#S_011MCMP *OUTPUT)(#COUNTER *HIDDEN));
********** COMMENT(Browselist coming from SET011A with the menu and);
********** COMMENT(submenu descriptions.);
DEF_LIST NAME(#DATALISTW) FIELDS((#S_011MNUM)(#S_011MDES)(#S_011MTYP)(#S_011MCOL)(#S_011MFLG)(#DEPTMENT)(#SECTION)) TYPE(*WORKING) ENTRYS(0009999);
********** COMMENT(Build the menu options only the first time invoked);
IF COND('#mode *ne Y');
CHANGE FIELD(#MODE) TO(Y);
EXECUTE SUBROUTINE(BLD_MENU);
GOTO LABEL(REQ);
ENDIF;
********** COMMENT();
REQ: REQUEST FIELDS(#PANELDATA) BROWSELIST(#S_011MTRE) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO);
********** COMMENT(Dummy DISPLAY to cause the browselist to be sent to);
********** COMMENT(the browser.);
IF COND('1 *EQ 2');
DISPLAY BROWSELIST(#S_011MSTY) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO);
ENDIF;
********** COMMENT(Dummy DISPLAY to cause the browselist to be sent to);
********** COMMENT(the browser.);
IF COND('1 *EQ 2');
DISPLAY BROWSELIST(#S_011MDIV) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO);
ENDIF;
********** COMMENT(*******************************************************);
********** COMMENT(Subroutine ....: BLD_MENU);
********** COMMENT(Description....: Build Tree Menu);
********** COMMENT(*******************************************************);
SUBROUTINE NAME(BLD_MENU);
********** COMMENT(*******************************************************);
DEFINE FIELD(#PREV_MNUM) REFFLD(#S_011MNUM) DEFAULT(0);
CLR_LIST NAMED(#S_011MTRE);
********** COMMENT(Create Menu Array);
CHANGE FIELD(#S_011MCMP) TO(S_011CREATEMNU);
ADD_ENTRY TO_LIST(#S_011MTRE);
********** COMMENT(S_011MTYP = 'M' (menu) and for each one of those, its);
********** COMMENT(submenu options (S_011MTYP = 'S').);
SELECTLIST NAMED(#DATALISTW);
********** COMMENT(Create Sub Item Array for each sub item group. Menu and);
********** COMMENT(Sub Menu items are grouped together by S_011MNUM. A);
********** COMMENT(number different than the previous one indicates the);
********** COMMENT(the entry is a Menu, otherwise it is a submenu of the);
********** COMMENT(current menu.);
IF COND('#PREV_MNUM *ne #S_011MNUM');
CHANGE FIELD(#PREV_MNUM) TO(#S_011MNUM);
EXECUTE SUBROUTINE(TYPEMLOGIC);
ELSE;
EXECUTE SUBROUTINE(TYPESLOGIC);
ENDIF;
********** COMMENT();
ENDSELECT;
********** COMMENT(Build Main Menu Items);
SELECTLIST NAMED(#DATALISTW) WHERE('#S_011MTYP = M');
CHANGE FIELD(#S_011MCMP) TO(S_011ADDMNULST);
ADD_ENTRY TO_LIST(#S_011MTRE);
ENDSELECT;
********** COMMENT(Initialse and build the entire menu);
CHANGE FIELD(#S_011MCMP) TO(S_011BUILDMNU);
ADD_ENTRY TO_LIST(#S_011MTRE);
********** COMMENT(Build STYLES and DIV Browselists);
EXECUTE SUBROUTINE(BLD_STYDIV);
ENDROUTINE;
********** COMMENT(=======================================================);
********** COMMENT(Subroutine ....: TYPEMLOGIC);
********** COMMENT(Description....: Process Type 'M' entries. Build all);
********** COMMENT(Menu Sub Items.);
********** COMMENT(=======================================================);
SUBROUTINE NAME(TYPEMLOGIC);
********** COMMENT(Determine whether to present the menu item initially);
********** COMMENT(expanded depending on the value of S_011MFLG.);
IF COND('#S_011MFLG *EQ E');
CHANGE FIELD(#MENUFLG) TO('''true''');
ELSE;
CHANGE FIELD(#MENUFLG) TO('''false''');
ENDIF;
CHANGE FIELD(#S_011MCMP) TO(S_011CREATESUB);
ADD_ENTRY TO_LIST(#S_011MTRE);
ENDROUTINE;
********** COMMENT(=======================================================);
********** COMMENT(Subroutine ....: TYPESLOGIC);
********** COMMENT(Description....: Process Type 'S' entries);
********** COMMENT(=======================================================);
SUBROUTINE NAME(TYPESLOGIC);
********** COMMENT(Add all Sub Items for each Sub item group.);
IF COND('#S_011MCOL *EQ *BLANK');
CHANGE FIELD(#S_011MCOL) TO('''#FFFFFF''');
ENDIF;
CHANGE FIELD(#S_011MCMP) TO(S_011ADDSUBITM);
ADD_ENTRY TO_LIST(#S_011MTRE);
ENDROUTINE;
********** COMMENT(=======================================================);
********** COMMENT(Subroutine ....: BLD_STYDIV);
********** COMMENT(Description....: Build STYLES and DIV Browselist (for);
********** COMMENT(Internet Explorer));
********** COMMENT(=======================================================);
SUBROUTINE NAME(BLD_STYDIV);
CLR_LIST NAMED(#S_011MSTY);
CLR_LIST NAMED(#S_011MDIV);
CHANGE FIELD(#COUNTER) TO(*ZEROS);
SELECTLIST NAMED(#DATALISTW);
CHANGE FIELD(#COUNTER) TO('#COUNTER + 1');
CHANGE FIELD(#S_011MCMP) TO(S_011MSTY);
ADD_ENTRY TO_LIST(#S_011MSTY);
CHANGE FIELD(#S_011MCMP) TO(S_011MDIV);
ADD_ENTRY TO_LIST(#S_011MDIV);
ENDSELECT;
ENDROUTINE;