ND = MOD(NYMD,100) + M
IF (ND.EQ.0) THEN
ND = NDPM(NM)
IF (NM.EQ.2 .AND. LEAP(NY)) ND = 29
IF (ND.EQ.29 .AND. NM.EQ.2 .AND. LEAP(NY)) GO TO 20
IF (ND.GT.NDPM(NM)) THEN
ND = 1
INCYMD = NY*10000 + NM*100 + ND
ND = MOD(NYMD,100)
ND = ND + NDPM(NM)
IF (NM.EQ.2 .AND. LEAP(NY)) ND = ND + 1
MODYMD = ND