*---------*---------------*-----------------*----------------*---------------* | CODE | FACTOR 1 | FACTOR 2 | RESULT | INDICATORS | | | | | FIELD | | *---------*---------------*-----------------*----------------*---------------* | WHXX | Comparand | Comparand | | | *---------*---------------*-----------------*----------------*---------------*
The WHxx operations of a select group determine where control passes after the SELEC (Begin a Select Group) operation is processed.
The WHxx conditional operation is true if factor 1 and factor 2 have the relationship specified by xx If the condition is true, the operations following the WHxx are processed until the next WHxx, OTHER, ENDSL, or END operation.
When performing the WHxx operation remember:
Refer to Compare Operations for valid values for xx.
Figure "WHxx Operation" shows an example of the WHxx operation.
*...1....+....2....+....3....+....4....+....5....+....6....+....7... CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++ C* C* The following example shows nested SELEC groups. The employee C* type can be one of 'C' for casual, 'T' for retired, 'R' for C* regular, and 'S' for student. Depending on the employee type C* (EMPTYP), the number of days off per year (DAYS) will vary. C* C SELEC C EMPTYP WHEQ 'C' C EMPTYP OREQ 'T' C Z-ADD0 DAYS C EMPTYP WHEQ 'R' C* C* When the employee type is 'R', the days off depend also on the C* number of years of employment. The base number of days is 14. C* For less than 2 years, no extra days are added. Between 2 and C* 5 years, 5 extra days are added. Between 6 and 10 years, 10 C* extra days are added, and over 10 years, 20 extra days are added. C* C Z-ADD14 DAYS C* C* Nested select group. C SELEC C YEARS WHLT 2 C YEARS WHLE 5 C ADD 5 DAYS C YEARS WHLE 10 C ADD 10 DAYS C OTHER C ADD 20 DAYS C ENDSL C* End of nested select group. C* C EMPTYP WHEQ 'S' C Z-ADD5 DAYS C ENDSL
*...1....+....2....+....3....+....4....+....5....+....6....+....7... CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++ C* Example of a SELEC group with complex WHxx expressions. Assume C* that a record and an action code have been entered by a user. C* Select one of the following: C* * When F3 has been pressed, do subroutine QUIT. C* * When action code A (add) was entered and the record does not C* exist (*IN50=1), write the record. C* * When action code A is entered, the record exists, and the C* active record code for the record is D (deleted); update C* the record with active rec code=A. When action code D is C* entered, the record exists, and the ACREC code is A; mark C* the record as deleted. C* * When action code is C (change), the record exists, and the C* ACREC code is A; update the record. C* * Otherwise, do error processing. C* C RSCDE CHAINFILE 50 C SELEC C *INKC WHEQ *ON C EXSR QUIT C ACODE WHEQ 'A' C *IN50 ANDEQ*ON C WRITEREC C ACODE WHEQ 'A' C *IN50 ANDEQ*OFF C ACREC ANDEQ'D' C ACODE OREQ 'D' C *IN50 ANDEQ*OFF C ACREC ANDEQ'A' C MOVE ACODE ACREC C UPDATREC C ACODE WHEQ 'C' C *IN50 ANDEQ*OFF C ACREC ANDEQ'A' C UPDATREC C OTHER C EXSR ERROR C ENDSL
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.