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: 8165
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: 6968
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: 10326
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
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am

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