Here's another version of the example Waz started. This creates the where statements based on the input string.
-*
-SET &STRING = '''AAA***CCC***'' OR ''EEEFFF******'' OR ''IIIJJJ******''' ;
-*
-SET &NO_QUOTE = STRIP(&STRING.LENGTH,&STRING,'''','A&STRING.LENGTH') ;
-SET &NO_OR = STRREP (&NO_QUOTE.LENGTH,&NO_QUOTE,4,' OR ',1,',',&NO_QUOTE.LENGTH,'A&NO_QUOTE.LENGTH') ;
-*
-TYPE ----------------------------------------------------------------------------
-TYPE STRING ------- &STRING
-TYPE NO_QUOTE ----- &NO_QUOTE
-TYPE NO_OR -------- &NO_OR
-TYPE ----------------------------------------------------------------------------
-*
-SET &CNTR = 0;
-SET &P1_CNT = 0;
-SET &P1_TXT = 'ALL';
-SET &P2_CNT = 0;
-SET &P2_TXT = 'ALL';
-SET &P3_CNT = 0;
-SET &P3_TXT = 'ALL';
-SET &P4_CNT = 0;
-SET &P4_TXT = 'ALL';
-*
-TYPE ---------- LOOP BEGIN ----------
-:LOOP_BEG
-*
-SET &CNTR = &CNTR + 1;
-SET &ITEM = GETTOK(&NO_OR,&NO_OR.LENGTH,&CNTR,',',12,'A12');
-*
-IF &ITEM EQ ' ' THEN GOTO :LOOP_END;
-*
-SET &P1_VAL = EDIT(&ITEM,'999$$$$$$$$$');
-SET &P2_VAL = EDIT(&ITEM,'$$$999$$$$$$');
-SET &P3_VAL = EDIT(&ITEM,'$$$$$$999$$$');
-SET &P4_VAL = EDIT(&ITEM,'$$$$$$$$$999');
-*
-TYPE CNTR -------- &CNTR
-TYPE ITEM -------- &ITEM
-TYPE P1_VAL ------ &P1_VAL
-TYPE P2_VAL ------ &P2_VAL
-TYPE P3_VAL ------ &P3_VAL
-TYPE P4_VAL ------ &P4_VAL
-*
-SET &P1_CNT = IF &P1_VAL EQ '***' THEN &P1_CNT ELSE &P1_CNT + 1;
-SET &P1_TXT = IF &P1_VAL EQ '***' THEN &P1_TXT ELSE IF &P1_CNT EQ 1 THEN '''' | &P1_VAL | '''' ELSE &P1_TXT | ',' | '''' | &P1_VAL | '''';
-*
-SET &P2_CNT = IF &P2_VAL EQ '***' THEN &P2_CNT ELSE &P2_CNT + 1;
-SET &P2_TXT = IF &P2_VAL EQ '***' THEN &P2_TXT ELSE IF &P2_CNT EQ 1 THEN '''' | &P2_VAL | '''' ELSE &P2_TXT | ',' | '''' | &P2_VAL | '''';
-*
-SET &P3_CNT = IF &P3_VAL EQ '***' THEN &P3_CNT ELSE &P3_CNT + 1;
-SET &P3_TXT = IF &P3_VAL EQ '***' THEN &P3_TXT ELSE IF &P3_CNT EQ 1 THEN '''' | &P3_VAL | '''' ELSE &P3_TXT | ',' | '''' | &P3_VAL | '''';
-*
-SET &P4_CNT = IF &P4_VAL EQ '***' THEN &P4_CNT ELSE &P4_CNT + 1;
-SET &P4_TXT = IF &P4_VAL EQ '***' THEN &P4_TXT ELSE IF &P4_CNT EQ 1 THEN '''' | &P4_VAL | '''' ELSE &P4_TXT | ',' | '''' | &P4_VAL | '''';
-*
-GOTO :LOOP_BEG
-:LOOP_END
-TYPE ---------- LOOP END ------------
-*
-SET &P1_WHE = IF &P1_CNT EQ 0 THEN '' ELSE IF &P1_CNT EQ 1 THEN 'WHERE FIELD1 EQ ' | &P1_TXT ELSE 'WHERE FIELD1 IN (' | &P1_TXT | ')';
-SET &P2_WHE = IF &P2_CNT EQ 0 THEN '' ELSE IF &P2_CNT EQ 1 THEN 'WHERE FIELD2 EQ ' | &P2_TXT ELSE 'WHERE FIELD2 IN (' | &P2_TXT | ')';
-SET &P3_WHE = IF &P3_CNT EQ 0 THEN '' ELSE IF &P3_CNT EQ 1 THEN 'WHERE FIELD3 EQ ' | &P3_TXT ELSE 'WHERE FIELD3 IN (' | &P3_TXT | ')';
-SET &P4_WHE = IF &P4_CNT EQ 0 THEN '' ELSE IF &P4_CNT EQ 1 THEN 'WHERE FIELD4 EQ ' | &P4_TXT ELSE 'WHERE FIELD4 IN (' | &P4_TXT | ')';
-*
-TYPE ----------------------------------------------------------------------------
-TYPE P1_CNT ------ &P1_CNT
-TYPE P1_TXT ------ &P1_TXT
-TYPE P2_CNT ------ &P2_CNT
-TYPE P2_TXT ------ &P2_TXT
-TYPE P3_CNT ------ &P3_CNT
-TYPE P3_TXT ------ &P3_TXT
-TYPE P4_CNT ------ &P4_CNT
-TYPE P4_TXT ------ &P4_TXT
-TYPE ------------------------ GENERATED WHERE STATEMENTS ------------------------
-TYPE P1_WHE ------ &P1_WHE
-TYPE P2_WHE ------ &P2_WHE
-TYPE P3_WHE ------ &P3_WHE
-TYPE P4_WHE ------ &P4_WHE
-TYPE ----------------------------------------------------------------------------
Maybe this will help!
~Jim
WebFocus 8.201M, Windows, App Studio