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 

Update Date in 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
ragha
Beginner


Joined: 26 Apr 2005
Posts: 6
Topics: 2

PostPosted: Thu May 26, 2005 5:12 pm    Post subject: Update Date in REXX Reply with quote

Hi ,

My mainframe time is 12 hours behind the actual time. When I get
DATE() from the REXX it gives me the date 12 hours behind the actual time. Is there any command in REXX which will give me the actual time ; something like DATE() + 12 hours
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu May 26, 2005 7:54 pm    Post subject: Reply with quote

Can't you just add 1 to the current date depending on what the current system TIME is?
Back to top
View user's profile Send private message
ragha
Beginner


Joined: 26 Apr 2005
Posts: 6
Topics: 2

PostPosted: Fri May 27, 2005 10:44 am    Post subject: Reply with quote

Sorry would not be able to do it as if the System time is greater than 12PM it will reflect the current date , and if I add 1 to the current date then it would show a future date , which is not desired. Any other idea is appreciated ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri May 27, 2005 11:28 am    Post subject: Reply with quote

Quote:

Sorry would not be able to do it as if the System time is greater than 12PM it will reflect the current date , and if I add 1 to the current date then it would show a future date , which is not desired. Any other idea is appreciated ?


ragha,

Hmm unless I am missing something , it is very easy. Time returns the local time in the 24-hour clock format: hh:mm:ss (hours,minutes, and seconds) by default. Here are some examples, assuming that the time is 4:54 p.m.:

Code:
                                     
  TIME()       ->   '16:54:22'                               
  TIME('C')    ->   '4:54pm'                                 
  TIME('H')    ->   '16'                                     
  TIME('L')    ->   '16:54:22.123456'   /* Perhaps */         
  TIME('M')    ->   '1014'           /* 54 + 60*16 */         
  TIME('N')    ->   '16:54:22'                               
  TIME('S')    ->   '60862'  /* 22 + 60*(54+60*16) */         


So if you take the hour portion and 12 to and negotiate that value to add 1 day or not.
Code:

If (hour + 12) > 24
   then add 1 day to the day portion of current date
   time = (hour + 12) - 24 concat minute concat seconds 
end-if

Make sure to check if it is a leapyear when adding 1 day

Check this link which discusses about checking the leapyear

http://www.mvsforums.com/helpboards/viewtopic.php?t=2977&highlight=leap

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ragha
Beginner


Joined: 26 Apr 2005
Posts: 6
Topics: 2

PostPosted: Fri May 27, 2005 12:35 pm    Post subject: Reply with quote

Thanks for the response. I better think that we can get the date from the DB2 table link get CURRENT TIMESTAMP + 12 HOURS, but I dont know how to execute DB2 commands through REXX. If anybody has a sample or template , that would be useful.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri May 27, 2005 12:41 pm    Post subject: Reply with quote

ragha ,

Please search before posting. Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=3155&highlight=db2

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Fri May 27, 2005 4:41 pm    Post subject: Reply with quote

Why go to all that trouble for a simple 2 line programming problem?
Code:
if time('H') <= 11 then                 
  say date()                             
else                                     
  say date(,1+date('B'),'B')

which can be simplified to a single expression.
Code:
say date(,(time('H')>11)+date('B'),'B')
Back to top
View user's profile Send private message Visit poster's website
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