View previous topic :: View next topic
|
Author |
Message |
manugeorge2004
New User
Joined: 17 Jun 2009 Posts: 38 Location: Denver
|
|
|
|
Hi
Do we have a COBOL function to get current month minus one.
The program is not DB2. So I cannot use SQL queries
You help is appreciated |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
There is no function that directly gives you current month minus one, but it is not a hard calculation. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Before implementing some calculation, you need to verify the "rules" for calendar processing in your organization. Different places have different rules about what is "minus one month". |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
to get current month minus one. |
minus one what? day, hour, year, month?????????????????
if you want answers, you have to give a little information. |
|
Back to top |
|
|
manugeorge2004
New User
Joined: 17 Jun 2009 Posts: 38 Location: Denver
|
|
|
|
I need current month - 1 for MM part. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
manugeorge2004 wrote: |
I need current month - 1 for MM part. |
Robert Sample wrote: |
There is no function that directly gives you current month minus one, but it is not a hard calculation. |
Code: |
Compute MM = MM - 1
If MM = zero
move 12 to MM
compute YY = YY - 1
end-if |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I need current month - 1 for MM part. |
What if the "input" date was March 30, 2010 (03/30/2010)?
Suggest the resulting 02/30/2010 will not be acceptable. . . |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
as usual data calculations are a pain in the screen ...
as a general point
date related computations should be governed by standard rules within a COMPANY
and usually all the organizations have well documented standards and in house subroutines/functions on how to do it
so telling how to proceed might be wrong anyway
the best place to ask for suggestions would be Your support or Your manager! |
|
Back to top |
|
|
|