View previous topic :: View next topic
|
Author |
Message |
mainframe_world
New User
Joined: 22 Jan 2010 Posts: 12 Location: delhi
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Earl Haigh
Active User
Joined: 25 Jul 2006 Posts: 475
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Search this site for "CEEDAYS". You'll find hits regarding its use in date validation.
Bill |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Good point, Earl -- a number of my consulting assignments included expenses as well and they were in the U.S. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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
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. . . |
|
Back to top |
|
|
Earl Haigh
Active User
Joined: 25 Jul 2006 Posts: 475
|
|
|
|
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 ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Both. . .
However, getting older beats the alternative. . . . |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
mainframe_world
New User
Joined: 22 Jan 2010 Posts: 12 Location: delhi
|
|
|
|
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 |
|
|
|