Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 8055
Location: East Dubuque, Illinois, 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: 6967
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: 10256
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. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us