PDA

View Full Version : CVTDAT Command



Guest.Visitor
01-01-1995, 02:00 AM
I use this command extensively to validate and convert dates. One problem I've encountered is when sending an 8 positon date (*MDYY or *YYMD formats) if the date is before August 24, 1928 (Date of Birth) the command rejects it as out of range. I am puzzled as to why this date was chosen and can it be manipulated somehow to accept an earlier date. By the way, the high end of the range is May 9, 2071.

Guest.Visitor
03-20-1999, 01:12 PM
August 24 1928 is rather special in that the system (and a job) date cannot be set prior to August 23 1928 at 12:03:06 and 315 milliseconds; so CVTDAT sets the lower limit of its range to the first full day the system/job could currently be set to. Prior to V3R2 and V3R7 the low limit was Jan 1 1940 which corresponded to the previous system/job date threshold. When the system (in V3R2/V3R7) expanded the valid range of system/job dates CVTDAT was also expanded. Part of the rationale behind enforcing this limit was to avoid a CLP converting a date which may later, if used in a CHGJOB DATE(xxxxxx), cause a failure. I am not sure that this may have been the wisest thing to do but it was perhaps easiest back then to follow the pre-V3R2/V3R7 precedent. Note though that other APIs, such as the ILE Common Execution Environment Date and Time functions, support dates from 1582 to 9999 along with Database Date support for a year range from 1 to 9999; so from an application point of view there is certainly nothing wrong with dates prior to August 24 1928.