! 1. month between 1 and 12 to catch 13-20-85
DO while more data
LET noerror$ = "false"
READ when$
!LET when$ = "1-3-99"
IF when$[1:1]="0" then
PRINT "The month should not begin with '0'"
ELSE IF when$[pos(when$,"-")+1:pos(when$,"-")+1]="0" then
PRINT "The day should not begin with '0'"
ELSE IF val(when$[1:pos(when$,"-")-1])<1 then
PRINT "The month should be between 1 and 12"
ELSE IF val(when$[1:pos(when$,"-")-1])>12 then
PRINT "The month should be between 1 and 12"
ELSE
PRINT "The date is in correct format"
LET noerror$ = "true"
END IF
PRINT "noerror$ is ..."; noerror$
LOOP
DATA "01-11-11", "1-01-11", "1-11-11", "13-20-85"
END
The month should not begin with '0'
noerror$ is ...false
The day should not begin with '0'
noerror$ is ...false
The date is in correct format
noerror$ is ...true
The month should be between 1 and 12
noerror$ is ...false
! now put this coding element into PP6.2