+ Reply to Thread
Results 1 to 7 of 7

Thread: Add-duration

  1. #1
    Guest.Visitor Guest

    Default Add-duration

    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

  2. #2
    Guest.Visitor Guest

    Default Add-duration

    Could you post the snippet of code that you are using? Dave

  3. #3
    Guest.Visitor Guest

    Default Add-duration

    I have it saved in a Notepad text document.

  4. #4
    Guest.Visitor Guest

    Default Add-duration

    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 ..

  5. #5
    Guest.Visitor Guest

    Default Add-duration

    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

  6. #6
    Guest.Visitor Guest

    Default Add-duration

    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

  7. #7
    Guest.Visitor Guest

    Default Add-duration

    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

+ Reply to Thread

Similar Threads

  1. Date duration in CL
    By David Abramowitz in forum CL
    Replies: 4
    Last Post: 04-08-2005, 01:37 PM
  2. Calculate time duration
    By B.Morris in forum RPG
    Replies: 2
    Last Post: 11-04-2002, 08:42 AM
  3. Making some mistake while using Subtract duration
    By swadan in forum Programming
    Replies: 4
    Last Post: 10-06-2000, 05:47 AM
  4. Time duration
    By Guest.Visitor in forum Application Software
    Replies: 3
    Last Post: 07-15-2000, 05:25 AM
  5. QUERY date duration
    By Guest.Visitor in forum Application Software
    Replies: 4
    Last Post: 05-18-2000, 09:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts