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
 

 

To get previous day from date function

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

New User


Joined: 15 May 2006
Posts: 90

PostPosted: Tue Sep 18, 2007 2:49 pm    Post subject: To get previous day from date function
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: 2150
Location: At my coffee table

PostPosted: Tue Sep 18, 2007 2:55 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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: 90

PostPosted: Wed Sep 19, 2007 12:03 pm    Post subject:
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: 130
Location: Guntur

PostPosted: Fri Sep 21, 2007 3:13 pm    Post subject:
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: 1187
Location: Bangalore,India

PostPosted: Fri Sep 21, 2007 4:58 pm    Post subject:
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.

http://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    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
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts How to get previous month in SYMNAMES Suganya87 SYNCSORT 9 Fri Oct 28, 2016 1:37 pm


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