IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to calculate the date of current date-1 month?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
saubhik

New User


Joined: 21 Sep 2007
Posts: 35
Location: kolkata

PostPosted: Thu Mar 19, 2009 11:59 pm
Reply with quote

can anyone tell me how to calculate the date of 1 months back in cobol from current date.
example:
suppose i have a field current-date in my input file.i have to change this date to 1 month previous date and write that date into a file.how can i do that?

thanks,
saubhik
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Mar 20, 2009 12:21 am
Reply with quote

A quick COBOL forum search of "current date minus month" resulted in Date that will be 6 months less than the current date.....
Back to top
View user's profile Send private message
saubhik

New User


Joined: 21 Sep 2007
Posts: 35
Location: kolkata

PostPosted: Fri Mar 20, 2009 12:32 am
Reply with quote

thnks..but if i want do it in a simpler way...using cobol DATE routine
or inbuild functions..please suggest..
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Mar 20, 2009 12:34 am
Reply with quote

Just remember that some months are 30 days, 31 days, 28 days, or 29 days. That makes it rough when you have to use days for the calculations. Check and see if your site has a standard date calculation routine. I developed one in assembler to be called from cobol many years ago, it sure saved a lot of trouble. I received a lot of late night calls from idiots that passed bad data then got bad results and tried to blame me.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Mar 20, 2009 12:40 am
Reply with quote

In The Month difference bw the start date and end date
dick scherrer wrote:
Hello and welcome to the forum,

COBOL has nothing completely automatic.

Does the program use db2?

You might also look into using CEEDAYS (callable service).
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts To get the the current time DFSORT/ICETOOL 13
Search our Forums:

Back to Top