Function SET010 : Select Employee Based on Partial Employee Number

LANSA

Function SET010 : Select Employee Based on Partial Employee Number
********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_010);
********** COMMENT(Function .......: SET010);
********** COMMENT(Created on .....: 21/01/00 at 14:43:32);
********** COMMENT(Description ....: SELECT_SQL Example);
********** COMMENT(Version.........: 1);
********** COMMENT();
********** COMMENT(Full Description: The purpose of this function is to);
********** COMMENT(show how SELECT_SQL can be used with a);
********** COMMENT(variable and a LIKE parameter.);
********** COMMENT();
********** COMMENT(Disclaimer: The following material is supplied as an);
********** COMMENT(example only. No warranty is expressed or implied.);
********** COMMENT();
********** COMMENT(=======================================================);
********** COMMENT(Function control options);
FUNCTION OPTIONS(*DIRECT);
********** COMMENT();
********** COMMENT(Group and field definitions);
********** COMMENT();
OVERRIDE FIELD(#STD_TEXT) DESC('SQL Compares');
OVERRIDE FIELD(#STD_CODEL) DESC('Get EMPNO containing');
DEF_LIST NAME(#S_LSTPSLM) FIELDS(#EMPNO #SURNAME #GIVENAME #POSTCODE #PHONEHME);
********** COMMENT(Mainline);
********** COMMENT();
********** COMMENT();
BEGIN_LOOP;
REQUEST FIELDS(#STD_CODEL (#STD_TEXT *OUTPUT)) DESIGN(*DOWN) IDENTIFY(*DESC) BROWSELIST(#S_LSTPSLM);
CLR_LIST NAMED(#S_LSTPSLM);
********** COMMENT(note: #SETCND must be of length:);
********** COMMENT({the length of EMPNO + 2} or longer);
********** COMMENT(note: if using a different field name for #SETCND, );
********** COMMENT(the field name must be six characters or less);
********** COMMENT(note: for LIKE comparisons, the #SETCND field must be);
********** COMMENT(completely filled with % );
********** COMMENT(note: the #SETCND field name must not contain);
********** COMMENT(underscore characters if running on the AS400);
CHANGE FIELD(#SETCND) TO(#STD_CODEL);
DEFINE FIELD(#SETCND) LENGTH(*REFFLD *PLUS 2) REFFLD(#EMPNO);
USE BUILTIN(TCONCAT) WITH_ARGS('%' #SETCND '%%%%%%%%%%') TO_GET(#SETCND);
CHANGE FIELD(#STD_TEXT) TO(#SETCND);
SELECT_SQL FIELDS(#EMPNO #GIVENAME #SURNAME #POSTCODE #PHONEHME) FROM_FILES((PSLMST)) WHERE('EMPNO LIKE :SETCND');
ADD_ENTRY TO_LIST(#S_LSTPSLM);
ENDSELECT;
END_LOOP;