Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
vin12pr
Warnings : 1

New User

Joined: 14 Jun 2006
Posts: 56

 Posted: Wed Apr 25, 2007 12:08 pm    Post subject: How to get the value of (current date - 1 day) in cobol Hi, How to get the value of (current date - 1 day) in cobol? Thanks, Vin12pr

ashwinreddy

Active User

Joined: 16 Sep 2004
Posts: 106

 Posted: Wed Apr 25, 2007 12:20 pm    Post subject: 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
murmohk1

Senior Member

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

 Posted: Wed Apr 25, 2007 12:31 pm    Post subject: 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.
Arun Raj

Moderator

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

 Posted: Wed Apr 25, 2007 12:51 pm    Post subject: Hi vin12pr I think you will find something useful here... http://www.cse.ohio-state.edu/~sgomori/314/intrinsic.html Thanks Arun
Arun Raj

Moderator

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

Posted: Wed Apr 25, 2007 1:02 pm    Post subject:

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
William Thompson

Global Moderator

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

 Posted: Wed Apr 25, 2007 3:15 pm    Post subject: Have you looked at the intrinsic functions in the Enterprise COBOL Reference Manual?
rz061m

New User

Joined: 03 Mar 2006
Posts: 48
Location: Chennai

 Posted: Wed Apr 25, 2007 7:26 pm    Post subject: 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.
TG Murphy

Active User

Joined: 23 Mar 2007
Posts: 149

 Posted: Wed Apr 25, 2007 11:43 pm    Post subject: 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.
jasorn

Active User

Joined: 12 Jul 2006
Posts: 154
Location: USA

 Posted: Wed May 09, 2007 7:19 am    Post subject: Yeah, the instrinsic functions make date calculations a snap.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics How to display offset thru cobol prog... tvinodkumar7 CICS 2 Sun Apr 22, 2018 8:42 pm Linkage editor is part of COBOL, z/OS... ankit.jain COBOL Programming 4 Fri Apr 20, 2018 4:17 pm Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am Call COBOL or PLI with a click from w... vaibhav gs All Other Mainframe Topics 1 Mon Apr 16, 2018 7:29 pm COBOL MVS options BiswajitDG COBOL Programming 8 Fri Apr 06, 2018 12:35 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us