Page 1 of 1

Date validation?

PostPosted: Thu Jul 24, 2008 8:23 pm
by tamanini
Hi.

I need a date validate dd/mm/yyyy, exist simple someway to validate, like numerics variables, that it is validated with IS NUMERIC?
Or have I that the day verify if value is 1 to 30 or 1 to 31 or 1 to 28 or 1 to 29, according with month and year?
Would somebody have example some?

01  DATE-YYMMDD.
       05 WS-DATE-DD        PIC XX         VALUE SPACES.
       05 FILLER                 PIC X           VALUE '/'.   
       05 WS-DATE-MM       PIC XX         VALUE SPACES.
       05 FILLER                 PIC X           VALUE '/'.   
       05 WS-DATE-YY        PIC XX          VALUE SPACES.


Regards,
Marcelo Tamanini

Re: Date validation?

PostPosted: Thu Jul 24, 2008 10:06 pm
by dick scherrer
Hello tamanini and welcoem to the forums,

Does your system have db2 and are you allowed to use it?

Re: Date validation?

PostPosted: Fri Jul 25, 2008 1:21 am
by tamanini
No, I'm just reading sequential files and validating some fields like dates.

Re: Date validation?

PostPosted: Fri Jul 25, 2008 2:37 am
by dick scherrer
Hello,

Most organizations have a callable date validation routine - so that everyone is using the same "rules".

I'd suggest you ask your peers, manager, or tech support people if your system has such a routine.

Re: Date validation?

PostPosted: Fri Jul 25, 2008 5:20 pm
by tamanini
Actually, I'm started a course of mainframe and I have a exercise to date validate and others fields. Would you have such a routine? Or if it is possible, would you have some method to validate without a routine?

Thanks!

Re: Date validation?

PostPosted: Fri Jul 25, 2008 9:51 pm
by dick scherrer
Hello,

If this is a class exercise your best course of action is to write the code and post here when you have questions or problems.

Someone here will be able to answer.

I'd suggest you think thru what is needed - it will be more than which are the valid days in a month. You will need to consider leap years as well.

If you'd like, you can post the "rules" you determine and we can go over them before you spend time writing code.

Re: Date validation?

PostPosted: Sat Sep 06, 2008 8:17 am
by jollymcmuffin
i'm not sure i understand the problem correctly.. do you mean to say you want to validate if the date given is correct?

Re: Date validation?

PostPosted: Sat Sep 06, 2008 8:23 am
by dick scherrer
Hello and welcome to the forums,

Yes, that was the question.

As this is a class/learning exercise, please do not post the solution (i.e. "the code" that validates a date).

Thank you.

Re: Date validation?

PostPosted: Sat Sep 06, 2008 8:39 am
by jollymcmuffin
oh.. ok.. thanks for informing me dick.. :)