Rexx is a great option if possible. The program I coded (in ASM) probably had some overlap with your Rexx such as conversion, date subtraction, adding days, leap year, etc.

The folks who wrote the C function strftime() did a good job in my opinion, using %x variables to return various conversions. Another interesting one I use often is strtotime() in php, which reads a text string such as "2025/01/02" or "January 2nd, 2025" and does its best to figure out what was meant. It even converts text strings correctly like, "today", "tomorrow", "next week", and similar.

On 4/21/2025 7:00 PM, Mark Zelden wrote:
I've been doing it with my RDATE REXX for years. I have RDATEF also on my web 
site which
can be called as a REXX function instead. It was converting dates before it was
built into TSO REXX.

RDATE is used is a few of my public execs to calculate "days between" or 
display a date in a certain format.  The output is always
the same format, but then you can massage it the way you want. Description of 
RDATE from my web site...



REXX date conversion routine.
Convert MM DD YYYY, YYYY DDD, or NNNNN to standard date output that includes the day of 
week and the number of days (NNNNN) from January 1, 1900. This is not the same as the 
Century date! Valid input dates range from 01/01/1900 through 12/31/2172.  A parm of 
"TODAY" can also be passed to the date conversion routine. The output format is 
always as follows:

MM/DD/YYYY.JJJ NNNNN WEEKDAY



Regards,

Mark
--
Mark Zelden - Zelden Consulting Services - z/OS, OS/390 and MVS
ITIL v3 Foundation Certified
mailto:[email protected]
Mark's MVS Utilities: http://www.mzelden.com/mvsutil.html





On Sat, 19 Apr 2025 10:12:45 -0700, Tom Brennan <[email protected]> 
wrote:

Nice!  And I'd bet similar programs are all over the place, just not
standardized.  For example, I was told to write something similar in the
1990's for the COBOL programmers to use.  Date conversion, finding
Christmas, things like that.  I gave up at Easter.

Has anybody mentioned running the date command under USS, such as:
date -d '20250101' +%A

On 4/19/2025 8:42 AM, Russell Witt wrote:
Another option would be to use exploit a third-party product. If you have either CA 1 or TLMS 
installed as your Tape Management system, both have a set of macros that can do all kinds of date 
processing (add days, calculate the number of days between 2 dates, subtract days). And on of the 
things we do with date is to "expand" them; which means turning 2025/001 into 
"Wednesday, January 1st 2025". So you can get the character form of any date you supply.

Russell Witt
Broadcom

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Jousma, David
Sent: Friday, April 18, 2025 10:50 AM
To: [email protected]
Subject: Re: Day of week from a program

You are correct, but It appeared to me that Joe was looking to calculate from 
current time.

Dave Jousma
Vice President | Director, Technology Engineering





From: IBM Mainframe Discussion List <[email protected]> on behalf of Paul 
Gilmartin <[email protected]>
Date: Friday, April 18, 2025 at 11:47 AM
To: [email protected] <[email protected]>
Subject: Re: Day of week from a program



On Fri, 18 Apr 2025 15:39:20 +0000, Jousma, David wrote:



Again, why not query system symbol &LWDAY, instead of trying to
calculate?
https://urldefense.com/v3/__https://www.ibm.com/docs/en/zos/3.1.0?topic
=1-operation__;!!MwwqYLOC6b6whF7V!jjjrXaNBrDWXcSdx7cFjZJ6KViua-LtCTaLj0
FFh6e8ju61hiinUQe2J-nNMkM9SPgyeZloX_lDLpkxv2c9Gi2OH42t1D-VqqDo$<https:/
/urldefense.com/v3/__https:/www.ibm.com/docs/en/zos/3.1.0?topic=1-opera
tion__;!!MwwqYLOC6b6whF7V!jjjrXaNBrDWXcSdx7cFjZJ6KViua-LtCTaLj0FFh6e8ju
61hiinUQe2J-nNMkM9SPgyeZloX_lDLpkxv2c9Gi2OH42t1D-VqqDo$>



What if one needs the day of week corresponding to an archival timestamp?



--

gil



----------------------------------------------------------------------

For IBM-MAIN subscribe / signoff / archive access instructions,

send email to [email protected] with the message: INFO IBM-MAIN

This e-mail transmission contains information that is confidential and may be 
privileged.   It is intended only for the addressee(s) named above. If you 
receive this e-mail in error, please do not read, copy or disseminate it in any 
manner. If you are not the intended recipient, any disclosure, copying, 
distribution or use of the contents of this information is prohibited. Please 
reply to the message immediately by informing the sender that the message was 
misdirected. After replying, please erase it from your computer system. Your 
assistance in correcting this error is appreciated.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to