In actual application, we often need to check whether it is a new year? In general, we all use Digital computation. The following provides a simple method to share with you...
The command cvtdat already knows that the Year is the latest year, as long as the "0229" and the two-digit year are combined into the 'mmddyy' format,
The date numeric value of the command cvtdat. If the command cvtdat returns the numeric value "cpf0555 date numeric value or date format numeric value ",
It indicates that the two digit years are not the same year. If the two digit years are not the same, the two digit years are the same year.
Code:
PGM (& year)
DCL & year * char 2
DCL & mdy * char 6
Chgvar (& mdy) ('000000' * Cat & year)
Cvtdat date (& mdy) Tovar (& mdy) fromfmt (* mdy) tofmt (* mdy) tosep (* none)
Monmsg cpf0555 exec (DO)
Sndmsg msgid (cpf9898) msgf (qcpfmsg) +
Msgdta ('Year' * bcat & year * bcat 'is not leap year') +
Msgtype (* comp)
Return
Enddo
Sndmsg msgid (cpf9898) msgf (qcpfmsg) +
Msgdta ('Year' * bcat & year * bcat 'is leap year') +
Msgtype (* comp)
Endpgm