Hi,
I must validate a field A4, that contains the hour in format Hour(2) Minute(2) HHMM. As MM is interpreted as Month, I used
IF NOT
In a MASK clause, an H represents a hexadecimal digit, not an hour; there is no character to represent a minute.
For the hour value, test for 0-23. For the minute value, test for 0-59.
DEFINE DATA LOCAL
1 #A (A4) INIT <'1230'>
1 #T (T)
1 #M (A25)
END-DEFINE
*
REPEAT
INPUT #A (AD=MDLT)
// #T (AD=O ZP=F)
// #M (AD=O)
IF #A = MASK (00-23)
AND #A = MASK (..00-59)
THEN
MOVE EDITED #A TO #T (EM=HHII)
RESET #M
ELSE
ASSIGN #M = 'invalid time value'
RESET #T
END-IF
END-REPEAT
END
You can also use
IF #A = MASK (00-2300-59) ...
Ralph/ Wilfried:
Thank you very much for your comments. Both them were pretty useful for me, included the link to the documentation.
Regards, Fabi