A date field can be compared to a date constant or another date
field with the same number of non-year (x) digits. Table 1 shows
the type of field-to-field and field-to-constant comparisons you can
use. The fields shown for any type of date (for example, yyx and
xyy) can be compared to any other fields shown for that type of date
or to the Y constant shown for that type of date.
Table 1. Permissible Comparisons
for DatesPermissible Comparisons for Dates
Type of Date |
Fields
(m,f) |
Y Constant |
---|
yyx and xyy |
3,Y2T
3,Y2W
|
2,Y2U
2,Y2X
|
Y'yyx' |
yyxx and xxyy |
4,Y2T
4,Y2W
|
3,Y2V
3,Y2Y
|
Y'yyxx'
Y'DATE2'
Y'DATE2'+m
Y'DATE2'-m
|
yyxxx and xxxyy |
5,Y2T
5,Y2W
|
3,Y2U
3,Y2X
|
Y'yyxxx'
Y'DATE3'
Y'DATE3'+d
Y'DATE3'-d
|
yyxxxx and xxxxyy |
6,Y2T
6,Y2W
|
4,Y2V
4,Y2Y
|
Y'yyxxxx'
Y'DATE1'
Y'DATE1'+d
Y'DATE1'-d
|
yy |
2,Y2C
2,Y2S
1,Y2D
|
2,Y2Z
2,Y2P
1,Y2B
|
Y'yy' |
Y constants for current, future, and past two-digit
year dates are as follows. d can be 0 to 9999 days and m can be 0
to 9999 months.
- Y'DATE1' generates a Y constant for the current date in the form
Y'yymmdd'
- Y'DATE1'+d generates a Y constant for the current date plus d
days in the form Y'yymmdd'
- Y'DATE1'-d generates a Y constant for the current date minus d
days in the form Y'yymmdd'
- Y'DATE2' generates a Y constant for the current date in the form
Y'yymm'
- Y'DATE2'+m generates a Y constant for the current date plus m
months in the form Y'yymm'
- Y'DATE2'-m generates a Y constant for the current date minus m
months in the form Y'yymm'
- Y'DATE3' generates a Y constant for the current date in the form
Y'yyddd'
- Y'DATE3'+d generates a Y constant for the current date plus d
days in the form Y'yyddd'
- Y'DATE3'-d generates a Y constant for the current date minus d
days in the form Y'yyddd'.
You must use the same number of digits in a Y constant
as the type of date; leading zeros must be specified (for example,
for Y'yymm', use Y'0001' for January 2000 and Y'0501' for January
2005).
You can also use Y constants for special indicators as follows:
- Y'0...0' (CH/ZD/PD zeros) and Y'9...9' (CH/ZD/PD nines) can be
used with Y2T, Y2U, Y2V, Y2W, Y2X and Y2Y dates. You must use the
same number of digits as the type of date (for example, Y'000' for
yyq or qyy, Y'0000' for yymm or mmyy, and so forth).
- Y'LOW' (BI zeros), Y'BLANKS' (blanks) and Y'HIGH' (BI ones) can
be used with Y2T, Y2W and Y2S dates.