MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to find the previous date using REXX !!

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 109
Topics: 36
Location: India

PostPosted: Thu Mar 23, 2006 2:32 am    Post subject: How to find the previous date using REXX !! Reply with quote

Hi,

How do we find the previous date. For e.g. today is 03/23/06 in DATE('U') format, but I have to do some processing for a file named as one of the LLQs in yesterday's date like xxx.yyy.060322

Pls let me know in how simplest of the ways this can be done. It should take care of leap year and year switch( i mean when switch to 2007 from 2006)

Kolusu I checked your forum for various functions related to date but I did not find related info, so posing the query.

Kindly respond.

Regards,
- Amit.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu Mar 23, 2006 5:48 am    Post subject: Reply with quote

Convert the Date(U) date to a base date Date(B).
Substract 1 from the base date.
Convert the base date back into Date(U) (or whatever other format you choose):

Code:

/* REXX */
today = '03/23/06'
basedate = Date('B',today,'U')
basedate = basedate - 1
yesterday = Date('U',basedate,'B')
Back to top
View user's profile Send private message
amit4u79
Beginner


Joined: 24 Oct 2005
Posts: 109
Topics: 36
Location: India

PostPosted: Thu Mar 23, 2006 9:23 pm    Post subject: Reply with quote

Hey Superk, thanks a lot for this. Actually I had converted the current date Date('D') and then subtracted 1 and then converted it to Date('O'), but then realised it would not work for say 01/01/2007 as -1 will give me 0.

But yes Base date is the right approach. I will change my code. thanks for this.

Regards,
- Amit.
_________________
I did not fail; I have found 10,000 ways that would not work - Albert Einstein.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group