On Thu, 14 Mar 2013 14:27:33 -0500, Joel C. Ewing wrote:

>environments.  I knew there were good reasons I preferred writing REXX
>rather than shell scripts on z/OS.
>
z/OS is inexorably POSIX.

>If I weren't retired, at a minimum I'd put date option "-d"
>implementation in as a SHARE requirement.  You really don't want people
>doing kludgey circumventions in scripts to perform their own relative
>date adjustments. Y2K re-mediation demonstrated there are just too many
>ways to do it incorrectly.
>  
Yup:  http://xkcd.com/1179/

>> On 03/14/2013 12:04 PM, Uwe Oswald wrote:
>>> Thank you for all your hints and tips but I need just one command
>>> without an additional script or similar since I need this for
>>> different customers. All that I want is just create a file with some
>>> content and give that file "yesterdays" date. In each other Unix
>>> version not a problem at all, but USS seems to be different. The
>>> "date...--date" syntax is invalid in USS. As I said in my first post,
>>> I tried nearly everything I believe.....
>>>
>>> HELP :-)
>>> 
Rexx provides an answer, and is uniformly available on z/OS systems,
but you need a single shell script that performs the function.  If you
are desperate enough to write a dozen-line Rexx EXEC to /tmp; call it;
then remove it, and that satisfies your unitarity constraint, the
following works:

#! /bin/sh
rexx=/tmp/yesterday.$$
rm -f "$rexx"

echo "/* Rexx */
parse value date( 'Base' ) time() with D T
say translate( 'ABCD-EF-GH', date( 'Standard', D - 1, 'Base', ), 'ABCDEFGH' ) T
exit( 0 )" >"$rexx"

chmod 755 "$rexx"
echo "Yesterday is $("$rexx")"; rm -f "$rexx"
exit $?

... producing output:

Yesterday is 2013-03-13 14:28:00

(I wouldn't try this in a tight loop.)

Don't we wish Rexx had a "-c" option, akin to sh?

-- gil

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

Reply via email to