IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 1436
Location: Bangalore,India

PostPosted: Wed Apr 25, 2007 12:31 pm
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: 2481
Location: @my desk

PostPosted: Wed Apr 25, 2007 12:51 pm
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: 2481
Location: @my desk

PostPosted: Wed Apr 25, 2007 1:02 pm
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: 3156
Location: Tucson AZ

PostPosted: Wed Apr 25, 2007 3:15 pm
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
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: 148
Location: Ottawa Canada

PostPosted: Wed Apr 25, 2007 11:43 pm
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
Warnings : 1

Active User


Joined: 12 Jul 2006
Posts: 191
Location: USA

PostPosted: Wed May 09, 2007 7:19 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top