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
 

 

Regarding DATE command in REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 160
Location: Bangalore

PostPosted: Fri Aug 07, 2009 2:14 pm    Post subject: Regarding DATE command in REXX
Reply with quote

Is there any solution for getting the month number from the DATE command in REXX.
i have tried using this function
Code:
CURRENT_MONTH = SUBSTR(DATE('U'),1,2) 
        which would return '08' 


but if i give the month name as REL=OCT im unable to get the month number
Code:
MONTH = SUBSTR(DATE('U','01 'REL' 2009,1,2)  This is returning me an error Incorrect call to routine


as i have gone through the DATE function
it suggests me to use in the manner
Code:
  DATE('U','01 Oct 2009') gives me result '10/01/09'
   but   DATE('U','01 OCT 2009') gives me incorrect result


is there any function in rexx to get OCT in camel notation so i would be solved my problem
Back to top
View user's profile Send private message

prino

Senior Member


Joined: 07 Feb 2009
Posts: 1027
Location: Oostende, Belgium

PostPosted: Fri Aug 07, 2009 2:54 pm    Post subject:
Reply with quote

Set up a stem,

Code:
camel.0JAN = 'Jan'
.
.
.
camel.0DEC = 'Dec'


and use the value function to get the 'camel'ised month. And RTFM so that you don't have to come back to ask how to use the value function!
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 160
Location: Bangalore

PostPosted: Fri Aug 07, 2009 3:03 pm    Post subject:
Reply with quote

let me put the question in this way,
is there any function which would return the month number
if we provide the first three chars of a month.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Aug 07, 2009 3:13 pm    Post subject:
Reply with quote

NO

But it's not difficult to do it yourself is it. It took me about 3 minutes to code this up, although Prino beat me to it with an alternative.

All you need to do is to put the code in a concatenated library and change it a little to make it a called module.
Code:

DATEIN = "01 APR 2009"                   
PARSE VAR DATEIN DD MM YY               
IF LEFT(DD,1) = '0' THEN DD = RIGHT(DD,1)
SELECT                                   
   WHEN MM = 'JAN' then MM = 'Jan'       
   WHEN MM = 'FEB' then MM = 'Feb'       
   WHEN MM = 'MAR' then MM = 'Mar'       
   WHEN MM = 'APR' then MM = 'Apr'       
   WHEN MM = 'MAY' then MM = 'May'       
   WHEN MM = 'JUN' then MM = 'Jun'       
   WHEN MM = 'JLY' then MM = 'Jly'       
   WHEN MM = 'AUG' then MM = 'Aug'       
   WHEN MM = 'SEP' then MM = 'Sep'       
   WHEN MM = 'OCT' then MM = 'Oct'       
   WHEN MM = 'NOV' then MM = 'Nov'       
   WHEN MM = 'DEC' then MM = 'Dec'       
   OTHERWISE NOP                         
END                                     
MTH = SUBSTR(DATE('U',DD MM YY,'N'),1,2)
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2050
Location: Silicon Valley

PostPosted: Fri Aug 07, 2009 9:48 pm    Post subject: Reply to: Regarding DATE command in REXX
Reply with quote

This just seems like a case situation. As long as you know what case the date function needs, program for it.
Code:
parse var mm m1 2 m2                           
mm =          m1 || ,                           
    translate(m2,'abcdefghijklmnopqrstuvwxyz',,
                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') 


ps. I am not sure if this any more elegant than the other solutions, but seems to be simpler to me.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Fri Aug 07, 2009 9:56 pm    Post subject: Reply to: Regarding DATE command in REXX
Reply with quote

since I am becoming like a picky old lady icon_biggrin.gif
here is how I would do it

Code:
datein  = "01 APR 2009"
parse var datein dd mm yy
mn = wordpos(translate(mm),"JAN FEB MAR APR MAY JUN JLY AUG SEP OCT NOV DEC")
say mn
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2050
Location: Silicon Valley

PostPosted: Sat Aug 08, 2009 3:53 am    Post subject: Reply to: Regarding DATE command in REXX
Reply with quote

Enrico, I do not think your code snippet answers the right problem. I thought the problem was that the DATE('U','01 OCT 2009') function failed because it wanted a mixed case month... Oct instead of OCT. At least, that is the way I read it, and also what the other posters seemed to solve.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Sat Aug 08, 2009 12:45 pm    Post subject: Reply to: Regarding DATE command in REXX
Reply with quote

Quote:
let me put the question in this way,
is there any function which would return the month number
if we provide the first three chars of a month.


it does, it does icon_biggrin.gif
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2050
Location: Silicon Valley

PostPosted: Sat Aug 08, 2009 10:30 pm    Post subject: Reply to: Regarding DATE command in REXX
Reply with quote

Doh!

I stand corrected.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Sat Aug 08, 2009 11:31 pm    Post subject: Reply to: Regarding DATE command in REXX
Reply with quote

no need for that.. You can sit corrected icon_cool.gif
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 160
Location: Bangalore

PostPosted: Mon Aug 10, 2009 10:46 am    Post subject:
Reply with quote

Thanks enrico,
for solving my problem in a simpler manner
icon_wink.gif
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm
No new posts REXX WTO for console message bipinpeter CLIST & REXX 6 Tue Jun 27, 2017 3:56 pm


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