IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Wanted to write date validation


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mainframe_world

New User


Joined: 22 Jan 2010
Posts: 12
Location: delhi

PostPosted: Sat Feb 27, 2010 11:38 am
Reply with quote

Hi,

I have a screen field that is "Eff-DATE" format (MMDDYY) on the screen and at the backend i have to store it like CCYYMMDD format.

I have to check for validation for month, date, year, century and check the leap year aslo.

Please anybody help me to write this logic.

Thanks
sharma
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sat Feb 27, 2010 11:46 am
Reply with quote

Hello,

Before you code, you need to know the "rules". . .

Most organizations either have a callable subroutine that does date validation and/or re-formatting. If your organization has such a routione, you should use it.

If there is not a routine, there will be documented rules as to how dates are to be handled. For example when to use 19 or 20 for the century.

Once you understand the date rules, suggest you post how you intend to write the code or the actual code you have written.

Someone here should be able to help - but do not expect someone to post already done code. . .
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Sat Feb 27, 2010 5:49 pm
Reply with quote

Quote:
Please anybody help me to write this logic.
Most of the people who respond on this forum are paid for their professional work product, which is what you are asking for. Unless you are willing to pay for such work (and rates of 1000 U. S. dollars per day or any fraction are common), please do not ask for code.

When you have a problem and post the code you're having problems with, usually people will help get the code right. But asking up front for code is not wise since it doesn't show any work you've done, and this is a HELP forum, not a DO-YOUR-JOB-FOR-YOU forum.
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Sat Feb 27, 2010 9:15 pm
Reply with quote

Quote:
this is a HELP forum, not a DO-YOUR-JOB-FOR-YOU forum.


Robert, for outside continental U.S., thats a 1000 U.S. Dollars per day + EXPENSES !
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat Feb 27, 2010 10:00 pm
Reply with quote

mainframe_world wrote:
I have to check for validation for month, date, year, century and check the leap year aslo.
Sounds like a COBOL 101 exercise.....
Month 1 to 12
Date 1 to 28,29,30,30 depending upon the month and leap year
Year 00 to 99 depending upon the posible range of 'eff dates'
Century 19 or 20 if the range of 'eff dates' is fairly current
Leap year is every 4th except some 00 years

A couple tables and a little math should provide you with validation needed.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Sat Feb 27, 2010 10:05 pm
Reply with quote

Search this site for "CEEDAYS". You'll find hits regarding its use in date validation.

Bill
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Sat Feb 27, 2010 10:29 pm
Reply with quote

Good point, Earl -- a number of my consulting assignments included expenses as well and they were in the U.S.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sat Feb 27, 2010 11:50 pm
Reply with quote

Hello,

When possible (for longer term engagements), i like having the hourly rate "loaded" to include expenses/extras (flying cross-country for a week or less is completely different). This way, when there is work for more than 40 hours a week, it is a kind of "overtime" which consultants often do not get icon_smile.gif

Being on the road, i'm usually willing to put in more time if a client wants. Well, i was. . . Since 2005 or so, i seldom bill more than 40 hrs a week. Getting slack. . . icon_rolleyes.gif
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Sun Feb 28, 2010 10:03 pm
Reply with quote

Quote:
Since 2005 or so, i seldom bill more than 40 hrs a week. Getting slack. . .


Dick, is that getting slack. . . , OR is it getting OLD ? icon_biggrin.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sun Feb 28, 2010 11:31 pm
Reply with quote

Both. . . icon_wink.gif

However, getting older beats the alternative. . . .
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Mon Mar 01, 2010 1:08 am
Reply with quote

Bill O'Boyle wrote:
Search this site for "CEEDAYS". You'll find hits regarding its use in date validation.
I've lost my pointer to the current LE bookshelf, any hints?

BTW, INTEGER-OF-DATE
Code:
    ___ Format _______________________________________________________________________________________
   |                                                                                                  |
   | >>__FUNCTION INTEGER-OF-DATE__(__argument-1__)________________________________________________>< |
   |                                                                                                  |
   |__________________________________________________________________________________________________|



argument-1
Must be an integer of the form YYYYMMDD, whose value is obtained from the calculation (YYYY * 10,000) + (MM * 100) + DD, where:

YYYY represents the year in the Gregorian calendar. It must be an integer greater than 1600, but not greater than 9999.

MM represents a month and must be a positive integer less than 13.

DD represents a day and must be a positive integer less than 32, provided that it is valid for the specified month and year combination.
Just what happens if the DD is not valid for the month and year combination?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Mar 01, 2010 1:56 am
Reply with quote

Guy,

Here's the Bookshelf link for z/OS V1R11.0 Language Environment -

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/CEE2BKA0

Date Intrinsic Functions, which require passing a value and were introduced with COBOL/370 (early 90's), will crash and burn if the passed-value were invalid.

OTOH, LE Callable Date routines (IE: CEEDAYS) will return a value of other than X'00's in the first two-bytes (addressed as a binary-halfword) of the 12-Byte Feedback Code parm, if the date-parm passed were invalid.

This why CEEDAYS can be used to validate dates, without causing an abend.

Bill
Back to top
View user's profile Send private message
mainframe_world

New User


Joined: 22 Jan 2010
Posts: 12
Location: delhi

PostPosted: Wed Mar 10, 2010 1:07 am
Reply with quote

Bill O'Boyle wrote:
Guy,

Here's the Bookshelf link for z/OS V1R11.0 Language Environment -

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/Shelves/CEE2BKA0

Date Intrinsic Functions, which require passing a value and were introduced with COBOL/370 (early 90's), will crash and burn if the passed-value were invalid.

OTOH, LE Callable Date routines (IE: CEEDAYS) will return a value of other than X'00's in the first two-bytes (addressed as a binary-halfword) of the 12-Byte Feedback Code parm, if the date-parm passed were invalid.

This why CEEDAYS can be used to validate dates, without causing an abend.

Bill


Thanks to all
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Date format correction using dfsort DFSORT/ICETOOL 3
No new posts batch SFTP job using AOPBATCH unable ... All Other Mainframe Topics 7
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts CONVERT a given date from UTC TO BST CICS 0
No new posts Pull data using date difference betwe... DB2 6
Search our Forums:

Back to Top