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 the value of (current date - 1 day) in cobol

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

New User


Joined: 14 Jun 2006
Posts: 56

PostPosted: Wed Apr 25, 2007 12:08 pm    Post subject: How to get the value of (current date - 1 day) in cobol
Reply with quote

Hi,

How to get the value of (current date - 1 day) in cobol?

Thanks,
Vin12pr
Back to top
View user's profile Send private message

ashwinreddy

Active User


Joined: 16 Sep 2004
Posts: 106
Location: Hyderabad

PostPosted: Wed Apr 25, 2007 12:20 pm    Post subject:
Reply with quote

Hi,

I am not sure whether this is possible in cobol, i think this cab be possible in db2 as (Date(ws-current) - day(1)).

As we need to consider even the date formats as ISO or jullian or GF (week format) etc.

As we use to call a date routine by passing all the required inputs.

May be some good answers follows from other members.

Cheers
Ashwin
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed Apr 25, 2007 12:31 pm    Post subject:
Reply with quote

Vin12pr,

I believe you need little brain storming and programming skills to acheive your requirement.

Accept the DAY value into the variable, deduct 1 and convert the value to date using some logic.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Wed Apr 25, 2007 12:51 pm    Post subject:
Reply with quote

Hi vin12pr

I think you will find something useful here...

http://www.cse.ohio-state.edu/~sgomori/314/intrinsic.html

Thanks
Arun
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2284
Location: @my desk

PostPosted: Wed Apr 25, 2007 1:02 pm    Post subject:
Reply with quote

Hi

I have modified the code from the above link.Plz let us know if it is correct.

Code:
    01  WS-TODAY       PIC 9(8).
    01  WS-PREV-DATE   PIC 9(8).
   ....

    MOVE FUNCTION CURRENT-DATE (1:8) TO WS-TODAY.
    COMPUTE WS-PREV-DATE =
              FUNCTION DATE-OF-INTEGER(FUNCTION INTEGER-OF-DATE(WS-TODAY) - 1 )



Thanks
Arun
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Apr 25, 2007 3:15 pm    Post subject:
Reply with quote

Have you looked at the intrinsic functions in the Enterprise COBOL Reference Manual?
Back to top
View user's profile Send private message
rz061m

New User


Joined: 03 Mar 2006
Posts: 48
Location: Chennai

PostPosted: Wed Apr 25, 2007 7:26 pm    Post subject:
Reply with quote

I am not sure of how the above code is going to work.

My suggestion will be, get the current date; convert it to Julian date and subtract one from it and then convert the julian date to normal for of your choice, PROVIDED YOU KNOW THE UTILITY USED IN YOUR SITE TO CONVERT DATES TO DIFFERENT FORMAT.
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Wed Apr 25, 2007 11:43 pm    Post subject:
Reply with quote

Guys,

The intrinsic functions work just fine. We have a sub-program that adds and subtracts from a date - it does not use the intrinsic functions because it was coded years ago - before the functions were available. We wanted to measure whether there would be any performance advantage in using the intrinsic function instead of our own routines. They both performed the same.

So we continue to use our utility.

However - like I said the instrinsic functions work great and are easy to use.
Back to top
View user's profile Send private message
jasorn

Active User


Joined: 12 Jul 2006
Posts: 153
Location: USA

PostPosted: Wed May 09, 2007 7:19 am    Post subject:
Reply with quote

Yeah, the instrinsic functions make date calculations a snap.
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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am


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