You can use DFSORT's TOGREG or TOJUL functions to identify invalid input dates. Dates with values outside of
the valid range (for example, a month not between 01-12) will be shown as asterisks making them easy to identify.
For example, if you had the following input records with 'yyyymmdd' dates:
Betten 20091021
Vezinaw 20091101
Casad 00000000
Boenig 20091325
Kolusu 20090931
Yaeger 20090731
You could use these DFSORT control statements to display an additional column with asterisks for any invalid
dates:
OPTION COPY
OUTREC OVERLAY=(30:16,8,Y4T,TOGREG=Y4T)
SORTOUT would have these records:
BETTEN 20091021 20091021
VEZINAW 20091101 20091101
CASAD 00000000 00000000
BOENIG 20091325 ********
KOLUSU 20090931 ********
YAEGER 20090731 20090731
If you wanted to display only the records with invalid dates, you could use these DFSORT control statements:
OPTION COPY
OUTREC OVERLAY=(30:16,8,Y4T,TOGREG=Y2T)
OUTFIL INCLUDE=(30,1,CH,EQ,C'*'),BUILD=(1,25)
SORTOUT would then have these records:
BOENIG 20091325
KOLUSU 20090931