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

Is there is any inbuilt date functions in REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
purushoth_jp

New User


Joined: 12 Dec 2004
Posts: 22

PostPosted: Wed Feb 21, 2007 5:21 pm
Reply with quote

Hi all,
I'm new to REXX, I want to know is there is any inbuilt date functions for date manipulations. If it is please let me know.
My requirement is to subtract 3 months from the current date and to display the result

ex.. if current date is 21-02-2007. then the result should be 21-12-2006.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Feb 21, 2007 5:23 pm
Reply with quote

There is a DATE built in finction, with some options. You can manipulate dates. Please refer to the fine manual.

O.
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Feb 21, 2007 7:10 pm
Reply with quote

You can display date functions in REXX by doing:

Code:

DATE1 = DATE('B')
SAY DATE1
DATE2 = DATE('D')
SAY DATE2
DATE3 = DATE('E')
SAY DATE3


Other date options are M, N, O, S, U, and W. Doing this will allow you to see the various formats of the dates. For example, DATE('E') is the european date and will look like 31/12/06.

The BASE date shown as DATE('B') is the numeric base date. You can convert any of the other dates to the base date (subtract 90 for 3 months) and convert the base date back to the original date.

This is done by:

Code:

CURRDT = DATE('E')                                   
/* CONVERT EUROPEAN DATE DD/MM/YY TO BASE (NUMERIC DATE) */
CURRBDTE = DATE('BASE',CURRDT,'EUROPEAN')
CURRBDTE = CURRBDTE - 90
/* CONVERT BASE DATE BACK TO EUROPEAN DATE */
NWCURRDT = DATE('EUROPEAN',CURRBDTE,'BASE')


You can also build your own date variables from your input. Just ensure they look exactly like the date function expects them to look (i.e. DD/MM/YY for european, 31 DEC 2006 for normal). They can then be converted to the base (numeric date), manipulated (like subtracting 90), and then converted back.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Feb 21, 2007 7:43 pm
Reply with quote

I've also found, through the years, that any existing in-house written date calculation routines, when properly written, typically work as well in a REXX program as they do in a COBOL or other language program.
Back to top
View user's profile Send private message
purushoth_jp

New User


Joined: 12 Dec 2004
Posts: 22

PostPosted: Sat Feb 24, 2007 5:35 pm
Reply with quote

Thanks for your reply. i tried its working.. thanks icon_smile.gif
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top