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

To get previous day from date function


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 92

PostPosted: Tue Sep 18, 2007 2:49 pm
Reply with quote

Hi,

I am retrieving current system date from the following syntax in COBOL:

Accept ws-date from date.

Now my requirement is to get yesterday's date.

So can you please tell me on how to get that.

Any kind of help will be really appreciated.

- Mohit
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Sep 18, 2007 2:55 pm
Reply with quote

Easiest would be to subtract one from INTEGER-OF-DATE of the current date followed by DATE-OF-INTEGER....
Back to top
View user's profile Send private message
kgumraj2

New User


Joined: 01 Aug 2007
Posts: 42
Location: Hyderabad

PostPosted: Tue Sep 18, 2007 3:13 pm
Reply with quote

Hi,

If you use, db2 use
EXEC SQL
SELECT ( CURRENT DATE -1 DAY)
INTO :<wS-VAR>
FROM SYSIBM.SYSDUMMY1
END-EXEC.
Back to top
View user's profile Send private message
snehalpatel

New User


Joined: 13 Sep 2007
Posts: 37
Location: India

PostPosted: Tue Sep 18, 2007 5:22 pm
Reply with quote

CICS Guy wrote:
Easiest would be to subtract one from INTEGER-OF-DATE of the current date followed by DATE-OF-INTEGER....


I could not understand by 'subtract one from INTEGER-OF-DATE of the current date followed by DATE-OF-INTEGER' ..

Can you please give some more idea on this .
Back to top
View user's profile Send private message
kgumraj2

New User


Joined: 01 Aug 2007
Posts: 42
Location: Hyderabad

PostPosted: Tue Sep 18, 2007 5:43 pm
Reply with quote

Hi,
Please find following code that might be of some use.

Code:

This converts date into integer.

compute DIFFERENCE-OF-DATES =         
 (FUNCTION INTEGER-OF-DATE (DT1) -   1)

This converts interger into date
compute DATE-var =         
 (FUNCTION DATE-OF-INTEGER(DIFFERENCE-OF-DATES )


Thanks.
Back to top
View user's profile Send private message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 92

PostPosted: Wed Sep 19, 2007 12:03 pm
Reply with quote

Thanks all for all the inputs.
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Fri Sep 21, 2007 3:13 pm
Reply with quote

Hi All,

I have one doubt,If you subtract one from date integer up to 2 of the month it will be okay, If it is 1st of month then if you subtract 1 from date it will becomes zero then your logic will not work.

we have take care of the year, month and the date integer too.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Fri Sep 21, 2007 4:58 pm
Reply with quote

Hi Bala,

Quote:
have one doubt,If you subtract one from date integer up to 2 of the month it will be okay, If it is 1st of month then if you subtract 1 from date it will becomes zero then your logic will not work.


It will work.Please go through it.

publib.boulder.ibm.com/infocenter/pdthelp/v1r1/index.jsp?topic=/com.ibm.entcobol3.doc/rlinfidt.htm
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
Search our Forums:

Back to Top