Function SET189H
********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_189);
********** COMMENT(Function .......: SET189H);
********** COMMENT(Created on .....: 22/09/00 at 14:43:32);
********** COMMENT(Description ....: SELECT_SQL - Sub-select parameter ALL);
********** COMMENT(Version.........: 1);
**********;
********** COMMENT(Full Description: The purpose of this function is to);
********** COMMENT(demonstrate the use Sub-select in SELECT_SQL );
********** COMMENT(and also the parameter ALL);
**********;
********** COMMENT(Note: To use variables in SELECT_SQL statements see);
********** COMMENT(example SET_010.);
**********;
********** COMMENT(Disclaimer: The following material is supplied as);
********** COMMENT(sample material only. No warranty concerning the);
********** COMMENT(material or its use in any way whatsoever is);
********** COMMENT(expressed or implied.);
**********;
********** COMMENT(Minimum LANSA release: 8.0);
**********;
********** COMMENT(=======================================================);
********** COMMENT(Function control options);
FUNCTION OPTIONS(*DIRECT);
**********;
OPEN USE_OPTION(*ONDEMAND);
********** COMMENT(Group and field definitions);
**********;
DEF_LIST NAME(#S_LSTPSL) FIELDS(#EMPNO);
DEFINE FIELD(#S_189TXT1) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT2) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT3) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT4) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT5) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT6) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT7) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
**********;
DEF_COND NAME(*AS400) COND('*CPUTYPE = AS400');
**********;
CHANGE FIELD(#S_189TXT1) TO('''Select all employees from the Personnel Master file whose salary is greater ''');
CHANGE FIELD(#S_189TXT2) TO('''than ALL employees in the range A0001 to A1007. This examples uses the ''');
CHANGE FIELD(#S_189TXT3) TO('''subselect parameter ALL.''');
CHANGE FIELD(#S_189TXT4) TO('''The subselection is executed first and creates an internal table. ''');
CHANGE FIELD(#S_189TXT5) TO('''When this is done, it compares the result of the internal table with PSLMST.''');
CHANGE FIELD(#S_189TXT6) TO('''This can be done with one SELECT_SQL statement.''');
CHANGE FIELD(#S_189TXT7) TO('''Note if using sub-select, PC & iSeries versions of the program are required.''');
**********;
BEGIN_LOOP;
CLR_LIST NAMED(#S_LSTPSL);
IF COND(*AS400);
SELECT_SQL FIELDS(#EMPNO) FROM_FILES((PSLMST)) WHERE('SALARY > ALL (SELECT SALARY FROM PSLMST WHERE EMPNO < ''A1007'')');
ADD_ENTRY TO_LIST(#S_LSTPSL);
ENDSELECT;
ELSE;
********** COMMENT(The PC version of the SELECT_SQL WHERE clause will not);
********** COMMENT(compile on the iSeries if a sub-select is used. );
********** COMMENT( Therefore, there must be a separate PC version);
********** COMMENT( of the program in this case. );
********** COMMENT(Function SET1892);
CALL PROCESS(*DIRECT) FUNCTION(SET1892);
ENDIF;
**********;
DISPLAY FIELDS(#S_189TXT1 #S_189TXT2 #S_189TXT3 #S_189TXT4 #S_189TXT5 #S_189TXT6 #S_189TXT7) DESIGN(*DOWN) IDENTIFY(*NOID) BROWSELIST(#S_LSTPSL);
END_LOOP;
********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_189);
********** COMMENT(Function .......: SET189H);
********** COMMENT(Created on .....: 22/09/00 at 14:43:32);
********** COMMENT(Description ....: SELECT_SQL - Sub-select parameter ALL);
********** COMMENT(Version.........: 1);
**********;
********** COMMENT(Full Description: The purpose of this function is to);
********** COMMENT(demonstrate the use Sub-select in SELECT_SQL );
********** COMMENT(and also the parameter ALL);
**********;
********** COMMENT(Note: To use variables in SELECT_SQL statements see);
********** COMMENT(example SET_010.);
**********;
********** COMMENT(Disclaimer: The following material is supplied as);
********** COMMENT(sample material only. No warranty concerning the);
********** COMMENT(material or its use in any way whatsoever is);
********** COMMENT(expressed or implied.);
**********;
********** COMMENT(Minimum LANSA release: 8.0);
**********;
********** COMMENT(=======================================================);
********** COMMENT(Function control options);
FUNCTION OPTIONS(*DIRECT);
**********;
OPEN USE_OPTION(*ONDEMAND);
********** COMMENT(Group and field definitions);
**********;
DEF_LIST NAME(#S_LSTPSL) FIELDS(#EMPNO);
DEFINE FIELD(#S_189TXT1) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT2) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT3) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT4) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT5) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT6) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
DEFINE FIELD(#S_189TXT7) TYPE(*CHAR) LENGTH(079) INPUT_ATR(LC);
**********;
DEF_COND NAME(*AS400) COND('*CPUTYPE = AS400');
**********;
CHANGE FIELD(#S_189TXT1) TO('''Select all employees from the Personnel Master file whose salary is greater ''');
CHANGE FIELD(#S_189TXT2) TO('''than ALL employees in the range A0001 to A1007. This examples uses the ''');
CHANGE FIELD(#S_189TXT3) TO('''subselect parameter ALL.''');
CHANGE FIELD(#S_189TXT4) TO('''The subselection is executed first and creates an internal table. ''');
CHANGE FIELD(#S_189TXT5) TO('''When this is done, it compares the result of the internal table with PSLMST.''');
CHANGE FIELD(#S_189TXT6) TO('''This can be done with one SELECT_SQL statement.''');
CHANGE FIELD(#S_189TXT7) TO('''Note if using sub-select, PC & iSeries versions of the program are required.''');
**********;
BEGIN_LOOP;
CLR_LIST NAMED(#S_LSTPSL);
IF COND(*AS400);
SELECT_SQL FIELDS(#EMPNO) FROM_FILES((PSLMST)) WHERE('SALARY > ALL (SELECT SALARY FROM PSLMST WHERE EMPNO < ''A1007'')');
ADD_ENTRY TO_LIST(#S_LSTPSL);
ENDSELECT;
ELSE;
********** COMMENT(The PC version of the SELECT_SQL WHERE clause will not);
********** COMMENT(compile on the iSeries if a sub-select is used. );
********** COMMENT( Therefore, there must be a separate PC version);
********** COMMENT( of the program in this case. );
********** COMMENT(Function SET1892);
CALL PROCESS(*DIRECT) FUNCTION(SET1892);
ENDIF;
**********;
DISPLAY FIELDS(#S_189TXT1 #S_189TXT2 #S_189TXT3 #S_189TXT4 #S_189TXT5 #S_189TXT6 #S_189TXT7) DESIGN(*DOWN) IDENTIFY(*NOID) BROWSELIST(#S_LSTPSL);
END_LOOP;