Rexx date

Ask/Clarify the questions on TSO, CLIST & REXX

Moderators: Veera, Moderator Group

Post Reply
simo78
Member
Posts: 35
Joined: Tue Aug 11, 2009 12:20 am
Location: Munich

Rexx date

Post by simo78 » Sat Oct 27, 2012 1:35 am

Hello together!
I need a help to solve a problem with REXX.
I've a variable with this content:
D12300 where 12 are the two digits for the year
(2012 in this case) and 300 is the day of the year
(the 300th day from the first of Januar- it means today).
My problem is that I want to convert this values to
get the date in this format: 26/10/2012.

Any ideas?
Thanks for any suggestions.
Regards

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Sat Oct 27, 2012 4:12 am

referring to 4.3.16 DATE

it looks like you could
x=date(,right(variable,5),'J')
which should give you 26 Nov 2012

then you could
y=date('U',x)
which would give you 10/26/12

so, putting it together this way

your_date=substr(y,4,3)||left(y,3)||right(x,4)
which should give you: 26/10/2012
you can do it anyway that you want
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Sat Oct 27, 2012 4:13 am

There's no date format exactly as you require, so I'd convert the julian date to the date sorted format:

thedate = Date('S',julian_date,'J')

which will give you 20121026 which you can then parse and string together into your format.

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Sat Oct 27, 2012 4:56 am

MrSpock,
just had to make it easy for him, didn't you? :P
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Sat Oct 27, 2012 6:36 pm

dbzTHEdinosauer wrote:MrSpock,
just had to make it easy for him, didn't you? :P
Sorry, I won't do it again! :wink:

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Sun Oct 28, 2012 8:49 am

Until next time - somebody has to be the good guy . . . 8)

simo78
Member
Posts: 35
Joined: Tue Aug 11, 2009 12:20 am
Location: Munich

Post by simo78 » Mon Oct 29, 2012 5:52 pm

Hi guys!

THANK YOU very much.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others