Add 7 days to the date filed

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
ickgeek23
Member
Posts: 17
Joined: Tue Sep 13, 2011 7:57 am

Add 7 days to the date filed

Post by ickgeek23 » Wed Oct 05, 2011 11:00 am

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,

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Oct 05, 2011 11:28 am

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
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

ickgeek23
Member
Posts: 17
Joined: Tue Sep 13, 2011 7:57 am

Post by ickgeek23 » Wed Oct 05, 2011 11:37 am

there is already a cobol program , but i need to include this condition (adding 7 days to the date field) in the cobol program..

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Oct 05, 2011 11:46 am

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.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

ickgeek23
Member
Posts: 17
Joined: Tue Sep 13, 2011 7:57 am

Post by ickgeek23 » Wed Oct 05, 2011 11:53 am

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

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Oct 05, 2011 1:22 pm

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.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Sat Oct 08, 2011 2:31 pm

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.
Regards,
Anuj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others