Page 1 of 1

Add 7 days to the date filed

Posted: Wed Oct 05, 2011 11:00 am
by ickgeek23
Hi All,

In one of my input file , i am receiving one date field as PIC X(8) format (eg: 20110101), now i have to add 7 days to this date filed and get the resultant date in PIC X(8) (in the above scenario it should be 20110108)same format. i have to consider leap year case also.....


can any one suggest me how to proceed....

Thanks in Advance,

Posted: Wed Oct 05, 2011 11:28 am
by dbzTHEdinosauer
most sites have established date routines.
suggest you inquire at your workplace, instead of a website that has no knowledge of your site.

after having done that and established that your site does not have an established date routine,
which I seriously doubt if it has been in business for more than a year,
you can look at the LE Overview
and determine which routines to use.
the routines can be found in one of the LE Manuals, found here

Posted: Wed Oct 05, 2011 11:37 am
by ickgeek23
there is already a cobol program , but i need to include this condition (adding 7 days to the date field) in the cobol program..

Posted: Wed Oct 05, 2011 11:46 am
by dbzTHEdinosauer
already a cobol program?
do you mean the one that is reading the file?

you should have a date-routine-module at your site,
which can be CALLed with parameters,
to perform functions on dates.

Posted: Wed Oct 05, 2011 11:53 am
by ickgeek23
yes, cobol program is reading the file, and doing some logic with the date, now i have to just add 7 days to this date ...

Posted: Wed Oct 05, 2011 1:22 pm
by dbzTHEdinosauer
well if you are going to be a one-man-band,
and incorporate in a module a date routine,
which should be available throughout your site (at least application-wise),
then refer to the links I provided in my first post,
(apparently you want to skip all the info about what LE is,
how it is used,
and other fundamental info
since you have not bothered to learn what is available at your site)
download the PROGRAMMERS REFERENCE manual,
look for ceedays and ceedate
which are used most often to calculate increments to dates.

Posted: Sat Oct 08, 2011 2:31 pm
by Anuj Dhawan
ickgeek23 - Dick has given you the correct advise, listen him.
yes, cobol program is reading the file, and doing some logic with the date, now i have to just add 7 days to this date ...
This sentence does not make much sense - what does this convey about what was asked.

You've two options:
  • You write your own date routine in COBOL
  • Use an existing date-routine at your shop
For the first case, it's most likely that your code review does NOT go well (okay, I hope code review exists there).

With second option, you'll be better off and that's what Dick has been suggesting you since start -- choice is yours.