Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to get Current month - 1 in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
manugeorge2004

New User


Joined: 17 Jun 2009
Posts: 35
Location: Denver

PostPosted: Tue Jun 01, 2010 10:46 pm    Post subject: How to get Current month - 1 in COBOL
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: 8280
Location: Dubuque, Iowa, USA

PostPosted: Tue Jun 01, 2010 10:53 pm    Post subject:
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

Site Director


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

PostPosted: Tue Jun 01, 2010 10:56 pm    Post subject:
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: 6970
Location: porcelain throne

PostPosted: Tue Jun 01, 2010 11:03 pm    Post subject:
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: 35
Location: Denver

PostPosted: Tue Jun 01, 2010 11:11 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Tue Jun 01, 2010 11:19 pm    Post subject:
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

Site Director


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

PostPosted: Tue Jun 01, 2010 11:49 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10456
Location: italy

PostPosted: Wed Jun 02, 2010 12:14 am    Post subject: Reply to: How to get Current month - 1 in COBOL
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts Call COBOL or PLI with a click from w... vaibhav gs All Other Mainframe Topics 1 Mon Apr 16, 2018 7:29 pm
No new posts COBOL MVS options BiswajitDG COBOL Programming 8 Fri Apr 06, 2018 12:35 am
No new posts batch cobol/db2 paragraph fall thru a... alois eisshofer COBOL Programming 5 Wed Mar 14, 2018 12:21 am
No new posts write multiple lines in PS file in cobol Balu5491 COBOL Programming 7 Wed Mar 07, 2018 10:27 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us