Date validation?



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Date validation?

Postby tamanini » Thu Jul 24, 2008 8:23 pm

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
tamanini
 
Posts: 3
Joined: Thu Jul 24, 2008 7:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Date validation?

Postby dick scherrer » Thu Jul 24, 2008 10:06 pm

Hello tamanini and welcoem to the forums,

Does your system have db2 and are you allowed to use it?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Date validation?

Postby tamanini » Fri Jul 25, 2008 1:21 am

No, I'm just reading sequential files and validating some fields like dates.
tamanini
 
Posts: 3
Joined: Thu Jul 24, 2008 7:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Date validation?

Postby dick scherrer » Fri Jul 25, 2008 2:37 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Date validation?

Postby tamanini » Fri Jul 25, 2008 5:20 pm

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!
tamanini
 
Posts: 3
Joined: Thu Jul 24, 2008 7:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Date validation?

Postby dick scherrer » Fri Jul 25, 2008 9:51 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Date validation?

Postby jollymcmuffin » Sat Sep 06, 2008 8:17 am

i'm not sure i understand the problem correctly.. do you mean to say you want to validate if the date given is correct?
jollymcmuffin
 
Posts: 8
Joined: Sun Aug 24, 2008 1:30 am
Has thanked: 0 time
Been thanked: 0 time

Re: Date validation?

Postby dick scherrer » Sat Sep 06, 2008 8:23 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Date validation?

Postby jollymcmuffin » Sat Sep 06, 2008 8:39 am

oh.. ok.. thanks for informing me dick.. :)
jollymcmuffin
 
Posts: 8
Joined: Sun Aug 24, 2008 1:30 am
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post