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

How to get Current month - 1 in COBOL


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

New User


Joined: 17 Jun 2009
Posts: 38
Location: Denver

PostPosted: Tue Jun 01, 2010 10:46 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Jun 01, 2010 10:53 pm
Reply with quote

There is no function that directly gives you current month minus one, but it is not a hard calculation.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jun 01, 2010 10:56 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jun 01, 2010 11:03 pm
Reply with quote

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
View user's profile Send private message
manugeorge2004

New User


Joined: 17 Jun 2009
Posts: 38
Location: Denver

PostPosted: Tue Jun 01, 2010 11:11 pm
Reply with quote

I need current month - 1 for MM part.
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: Tue Jun 01, 2010 11:19 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jun 01, 2010 11:49 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jun 02, 2010 12:14 am
Reply with quote

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
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top