Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Date Validation (DDMMYYYY) in RPGLE

2,401 views
Skip to first unread message

skpn...@gmail.com

unread,
Oct 25, 2014, 1:23:12 AM10/25/14
to
Hi

In my display file, field 'Date' with length 8 (format is DD/MM/YYYY). How can I check in RPGLE program whether value entered is correctly or not. For example, if user enter 49012014 then it should throw an error. I tried TEST(DE) *DMY SCREENDATE, but it didn't work because valid date is also throws error.

Any suggestions...Please help.

Regards
SK

Paul J. Therrien

unread,
Oct 26, 2014, 1:31:08 PM10/26/14
to
/free
monitor;
#workdate = %date(screendate : *eur);
on error;
(do error logic)
endmon;

- *DMY is only from dd/mm/yy (2 digit year)

Paul J. Therrien

unread,
Oct 26, 2014, 1:36:28 PM10/26/14
to
OR

test(DE) *eur screendate;

dgome...@gmail.com

unread,
Oct 27, 2014, 9:48:13 AM10/27/14
to
Skpn,

You got the error because a date format of DD/MM/YYYY is a *USA format not *DMY.
a *DMY format is DD/MM/YY. You could also just use a date field in your display file.


Paul,

*EUR format is DD.MM.YY, the date separator is different form what the OP posted. For testing it probably isn't a problem, but it probably is a good idea to use the correct format in the code for the type of date being displayed.

dgome...@gmail.com

unread,
Oct 27, 2014, 10:11:39 AM10/27/14
to
Ignore what I posted. I just realized I was wrong about what I posted. I mistook the date separators in the OP's post as indicting he was dealing with a *USA format.

Peter H. Coffin

unread,
Oct 27, 2014, 8:25:07 PM10/27/14
to
You were on the right track. The OP just needs to add the separators
desired for *EUR or *USA, then test.

--
Windows is a pane in the ass....
0 new messages