View Full Version : Add-duration
Guest.Visitor
01-01-1995, 02:00 AM
I'm trying to add 9 months to a field(CCYYMMDD) using ADD-DURATION, but I keep on getting an error message "The contents of date-time item does not match its format". Any other ideas how I might be able to convert this date. Jason Maynard
Guest.Visitor
02-29-2000, 10:10 AM
Could you post the snippet of code that you are using? Dave
Guest.Visitor
02-29-2000, 10:25 AM
I have it saved in a Notepad text document.
Guest.Visitor
02-29-2000, 11:56 AM
Jason, I have some code that will do the trick. I'm not sure how to post it. If it doesn't work, I'll ask how to post code. Here goes ... Mario P.S. - Why are you adding 9 months? Is it for a computerized family planning application for a human cloning business? If it is you can't use my code ... .. Just kidding, couldn't resist, no offense ..
Guest.Visitor
02-29-2000, 12:01 PM
Jason, That code was posted. Just click that test doc on. BTW - when I used the date "20020229", that was 02/29/2002, I received an error as well. The year 2002 is not a leap year, so 02/29/2002 is not a valid date. Check to make sure that the date is valid and the code should work. Mario
Guest.Visitor
03-01-2000, 07:18 AM
Jason, I just now looked at your code. It appears that some of the code is missing, but I don't think that is the problem. When defining date fields in ILE Cobol to manipulate using the date related functions ( adding or subtracting calendar units, testing the validity of dates, computing the calendar units between dates etc), I'm pretty sure that you have to have the dates defined as "FORMAT DATE" types with the appropriate date picture. The date picture that I used was for the CCYYMMDD date format. What I do if I have a date stored as PIC X(8) or PIC 9(8) is to move it to the fields defined as "FORMAT DATE", then I can do the date manipulations. Then you can move the resulting fields to wherever you want. I could be wrong, but from my own experience, I've never been able to make these date routines in ILE Cobol work with anything less that a field defined as "FORMAT DATE". The IBM documentation that I remember reading, all seem to use this same convention, so I went in the same direction. Check out the code that I posted. I'm using V4R4. It definitely works, but there could be other variations used as well. Mario
Guest.Visitor
03-01-2000, 09:41 AM
In order to use the xxx-DURATION verbs, you must use a date data type. You can not use a Character, or Numeric Field. Dave
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.