1.5.4 L4WEX03 List Example: Client Portion
Refer to 1.3 Test with the Verification and Sample Applications for details on using the following code example.
FUNCTION OPTIONS(*DIRECT);
**********;
DEFINE FIELD(#L4W_TEST) TYPE(*DEC) LENGTH(7) DECIMALS(0) LABEL('Number of Tests') EDIT_CODE(4) DEFAULT(50);
DEFINE FIELD(#L4W_LIST) TYPE(*DEC) LENGTH(7) DECIMALS(0) LABEL('Entrys in Lists') EDIT_CODE(4) DEFAULT(50);
DEFINE FIELD(#L4W_COUNT) TYPE(*DEC) LENGTH(7) DECIMALS(0);
DEFINE FIELD(#L4W_LISTC) TYPE(*DEC) LENGTH(7) DECIMALS(0);
DEFINE FIELD(#L4W_FC1) TYPE(*DEC) LENGTH(15) DECIMALS(0);
DEFINE FIELD(#L4W_FC2) TYPE(*DEC) LENGTH(15) DECIMALS(0);
DEFINE FIELD(#L4W_RSL1) TYPE(*DEC) LENGTH(15) DECIMALS(5);
DEFINE FIELD(#L4W_RSL2) TYPE(*DEC) LENGTH(15) DECIMALS(5);
DEFINE FIELD(#L4W_CMP1) TYPE(*DEC) LENGTH(15) DECIMALS(5);
DEFINE FIELD(#L4W_CMP2) TYPE(*DEC) LENGTH(15) DECIMALS(5);
DEFINE FIELD(#L4W_RETC) TYPE(*CHAR) LENGTH(2);
DEF_LIST NAME(#L4W_LIST1) FIELDS(#L4W_FC1 #L4W_FC2 #L4W_RSL1 #L4W_RSL2) TYPE(*WORKING) ENTRYS(100);
DEF_LIST NAME(#L4W_LIST2) FIELDS(#L4W_FC2 #L4W_FC1 #L4W_RSL1 #L4W_RSL2) TYPE(*WORKING) ENTRYS(100);
DEF_LIST NAME(#L4W_LIST3) FIELDS(#L4W_RSL1 #L4W_FC2 #L4W_FC1 #L4W_RSL2) TYPE(*WORKING) ENTRYS(100);
DEF_LIST NAME(#L4W_LIST4) FIELDS(#L4W_FC1 #L4W_RSL2 #L4W_RSL1 #L4W_FC2) TYPE(*WORKING) ENTRYS(100);
DEF_LIST NAME(#L4W_LIST5) FIELDS(#L4W_RSL1 #L4W_RSL2 #L4W_FC1 #L4W_FC2) TYPE(*WORKING) ENTRYS(100);
**********;
BEGIN_LOOP;
POP_UP FIELDS((#L4W_TEST *IN) (#L4W_LIST *IN)) DESIGN(*DOWN) PANEL_TITL('Perform Test Number 2') EXIT_KEY(*NO) PROMPT_KEY(*NO);
BEGINCHECK;
RANGECHECK FIELD(#L4W_TEST) RANGE((1 100000)) MSGTXT('Number of test must be in range 1 to 100000');
RANGECHECK FIELD(#L4W_LIST) RANGE((1 100)) MSGTXT('Entrys in list must be in range 1 to 100');
ENDCHECK;
**********;
**********;
BEGIN_LOOP USING(#L4W_COUNT) TO(#L4W_TEST);
CLR_LIST NAMED(#L4W_LIST1);
CLR_LIST NAMED(#L4W_LIST2);
CLR_LIST NAMED(#L4W_LIST3);
CLR_LIST NAMED(#L4W_LIST4);
CLR_LIST NAMED(#L4W_LIST5);
**********;
CHANGE FIELD(#L4W_RSL1 #L4W_RSL2) TO(0);
CHANGE FIELD(#L4W_FC1) TO(1);
CHANGE FIELD(#L4W_FC2) TO(#L4W_LIST);
BEGIN_LOOP TO(#L4W_LIST);
ADD_ENTRY TO_LIST(#L4W_LIST1);
ADD_ENTRY TO_LIST(#L4W_LIST2);
ADD_ENTRY TO_LIST(#L4W_LIST3);
ADD_ENTRY TO_LIST(#L4W_LIST4);
ADD_ENTRY TO_LIST(#L4W_LIST5);
CHANGE FIELD(#L4W_FC1) TO('#L4W_FC1 + 1');
CHANGE FIELD(#L4W_FC2) TO('#L4W_FC2 - 1');
END_LOOP;
USE BUILTIN(CALL_SERVER_FUNCTION) WITH_ARGS(SERVER L4WEX53 N N #L4W_LIST1 #L4W_LIST2 #L4W_LIST3 #L4W_LIST4 #L4W_LIST5) TO_GET(#L4W_RETC);
LEAVE IF('#L4W_RETC *NE OK');
**********;
CHANGE FIELD(#L4W_LISTC) TO(0);
SELECTLIST NAMED(#L4W_LIST1);
CHANGE FIELD(#L4W_CMP1) TO('#L4W_FC1 * #L4W_FC2');
CHANGE FIELD(#L4W_CMP2) TO('#L4W_FC1 / #L4W_FC2');
LEAVE IF('(#L4W_CMP1 *NE #L4W_RSL1) *OR (#L4W_CMP2 *NE #L4W_RSL2) ');
CHANGE FIELD(#L4W_LISTC) TO('#L4W_LISTC + 1');
ENDSELECT;
LEAVE IF('#L4W_LISTC *NE #L4W_LIST');
**********;
CHANGE FIELD(#L4W_LISTC) TO(0);
SELECTLIST NAMED(#L4W_LIST2);
CHANGE FIELD(#L4W_CMP1) TO('#L4W_FC1 * #L4W_FC2');
CHANGE FIELD(#L4W_CMP2) TO('#L4W_FC1 / #L4W_FC2');
LEAVE IF('(#L4W_CMP1 *NE #L4W_RSL1) *OR (#L4W_CMP2 *NE #L4W_RSL2) ');
CHANGE FIELD(#L4W_LISTC) TO('#L4W_LISTC + 1');
ENDSELECT;
LEAVE IF('#L4W_LISTC *NE #L4W_LIST');
**********;
CHANGE FIELD(#L4W_LISTC) TO(0);
SELECTLIST NAMED(#L4W_LIST3);
CHANGE FIELD(#L4W_CMP1) TO('#L4W_FC1 * #L4W_FC2');
CHANGE FIELD(#L4W_CMP2) TO('#L4W_FC1 / #L4W_FC2');
LEAVE IF('(#L4W_CMP1 *NE #L4W_RSL1) *OR (#L4W_CMP2 *NE #L4W_RSL2) ');
CHANGE FIELD(#L4W_LISTC) TO('#L4W_LISTC + 1');
ENDSELECT;
LEAVE IF('#L4W_LISTC *NE #L4W_LIST');
**********;
CHANGE FIELD(#L4W_LISTC) TO(0);
SELECTLIST NAMED(#L4W_LIST4);
CHANGE FIELD(#L4W_CMP1) TO('#L4W_FC1 * #L4W_FC2');
CHANGE FIELD(#L4W_CMP2) TO('#L4W_FC1 / #L4W_FC2');
LEAVE IF('(#L4W_CMP1 *NE #L4W_RSL1) *OR (#L4W_CMP2 *NE #L4W_RSL2) ');
CHANGE FIELD(#L4W_LISTC) TO('#L4W_LISTC + 1');
ENDSELECT;
LEAVE IF('#L4W_LISTC *NE #L4W_LIST');
**********;
CHANGE FIELD(#L4W_LISTC) TO(0);
SELECTLIST NAMED(#L4W_LIST5);
CHANGE FIELD(#L4W_CMP1) TO('#L4W_FC1 * #L4W_FC2');
CHANGE FIELD(#L4W_CMP2) TO('#L4W_FC1 / #L4W_FC2');
LEAVE IF('(#L4W_CMP1 *NE #L4W_RSL1) *OR (#L4W_CMP2 *NE #L4W_RSL2) ');
CHANGE FIELD(#L4W_LISTC) TO('#L4W_LISTC + 1');
ENDSELECT;
LEAVE IF('#L4W_LISTC *NE #L4W_LIST');
**********;
END_LOOP;
IF COND('#L4W_COUNT *LT #L4W_TEST');
MESSAGE MSGTXT('Test ***FAILED**');
ELSE;
MESSAGE MSGTXT('Test completed normally');
ENDIF;
END_LOOP;
**********;