Author: Arun Raj
Posted: Fri May 12, 2017 9:38 pm (GMT 5.5)
Rick,
A good friend and a mentor of mine pointed out that we could validate any input date by merely applying a date conversion on the input date field.
If the input date is invalid, the output date from the conversion would have asterisks ('*').
Ran a test and here is what I got.
SORTOUT had
For your requirement, you could do a similar conversion for each input date field and then check the resultant date for numeric data (using NUM), to achieve what you want.
For the first date field - date1 (YYMM), you might want to suffix '01' before the conversion.
Good luck!
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard
Posted: Fri May 12, 2017 9:38 pm (GMT 5.5)
Rick,
A good friend and a mentor of mine pointed out that we could validate any input date by merely applying a date conversion on the input date field.
If the input date is invalid, the output date from the conversion would have asterisks ('*').
Ran a test and here is what I got.
Code: |
//STEP01 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD * 20170228 20170229 20180229 20190229 20200229 20170332 20170500 20171301 //SORTOUT DD SYSOUT=* //SYSIN DD * OPTION COPY INREC OVERLAY=(10:1,8,Y4T,TOGREG=Y4T) |
SORTOUT had
Code: |
20170228 20170228 20170229 ******** 20180229 ******** 20190229 ******** 20200229 20200229 20170332 ******** 20170500 ******** 20171301 ******** |
For the first date field - date1 (YYMM), you might want to suffix '01' before the conversion.
Good luck!
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard