I finally RTFM (z/OS UNIX System Services Command Reference) which
documents that at least up to z/OS 1.13 the only documented options for
"date" are "-c" "-u" and "+format", and "-c" and "-u" are synonyms,
versus 7 distinct options for the date command, plus "--" counterpart
options, in Fedora. Unless there are undocumented features, this would
appear to be another of those many cases where the tools under z/OS UNIX
simply don't have all the features one finds in non-z/OS UNIX
environments. I knew there were good reasons I preferred writing REXX
rather than shell scripts on z/OS.
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.
JC Ewing
On 03/14/2013 01:46 PM, Joel C. Ewing wrote:
Is there support for "man date" under z/OS UNIX? Paul indicated that
the double-hypen parms are non-POSIX and therefore not supported under
z/OS; but "man date" under Fedora also shows "-d" as an alternative
for "--date=", so for example under Fedora it's also possible to use
date +%Y%m%d -d"1 day ago"
or
date +%Y%m%d -d"yesterday"
Maybe that form is supported?
P.S. I interpreted your original post as saying you had tried
date +%Y%m%d "yesterday"
where apparently you had intended to imply
date +%Y%m%d --date="yesterday"
JC Ewing
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 :-)
-----Ursprüngliche Nachricht-----
Von: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU]
Im Auftrag von Joel C. Ewing
Gesendet: Donnerstag, 14. März 2013 17:15
An: IBM-MAIN@LISTSERV.UA.EDU
Betreff: Re: AW: USS "date" command, subtract one day
Correct. So if you really want something that will work for all
dates, including first of month, first of month in March on leap and
nonleap year, first of year, etc. you need something else.
I'm not enough of a UNIX authority to know if this is standard for
all implementations of the UNIX date command and can't test in z/OS
environment, but a search for "relative dates" and "Linux" found a
"--date" parameter for the "date" command. At least on Fedora Linux
the date command already appears to have relative date calculation
built in.
Currently (2013-03-14) on Fedora the command date --date="14 days ago"
returns "Thu Feb 28 09:52:21 CST 2013"
and
date --date="379 days ago"
returns "Wed Feb 29 09:57:26 CST 2012"
If "date" under z/OZ UNIX supports the same parameters, then date
+%Y%m%d --date="1 day ago"
which today on Fedora returns "20130313" may be the form you need.
JC Ewing
On 03/14/2013 08:32 AM, Uwe Oswald wrote:
Thx perfect, thats exactly what I need. But I'm afraid this doesn’t
work for the first of a month for example 20130401 will then be
20130400 or I'm wrong?
-----Ursprüngliche Nachricht-----
Von: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU]
Im Auftrag von Rafal Hanzel ZETO Katowice
Gesendet: Donnerstag, 14. März 2013 13:23
An: IBM-MAIN@LISTSERV.UA.EDU
Betreff: Re: USS "date" command, subtract one day
Maybe something like that, will help you:
echo "`date +%Y%m%d` - 1" | bc
---
Pozdrawiam/Best regards,
Rafal Hanzel
Programista systemowy, Dział Badań i Rozwoju Systemów Komputerowych
Tel. +48 32 3589246, Fax +48 32 3589277, email:
hanz...@zetokatowice.pl Tel. kom. +48 501677656 Zakład
Elektronicznej Techniki Obliczeniowej w Katowicach Spółka z o.o.
40-158 Katowice, ul. Owocowa 1
Sąd Rejonowy Katowice - Wschód w Katowicach Wydział VIII Gospodarczy
Krajowego Rejestru Sądowego, KRS 0000051477 Kapitał zakładowy: 264500
zł NIP 634-013-11-06 http://www.zetokatowice.pl
Jesteśmy uczestnikiem Programu
RZETELNA Firma
Sprawdź naszą rzetelność na
http://www.rzetelnafirma.pl/8FGKEVFH
Treść tej informacji może być poufna, w związku z czym powinna
trafić bezpośrednio do rąk adresata. Jakiekolwiek jej ujawnianie,
rozpowszechnianie, bądź kopiowanie jest zabronione. W przypadku
omyłkowego otrzymania niniejszej informacji prosimy o poinformowanie
nadawcy i usunięcie jej z komputera.
W dniu 14.03.2013 12:54, Uwe Oswald napisał(a):
Hi,
I dont know if this is the right forum but I hope someone could help
anyway. I want to subtract "one day" from the actual date with one
USS unix command.
The actual date I get via "date +%Y%m%d" (for example 20130314), but
"date +%Y%m%d-1" or "...yesterday" don’t work. I have tried
everything without success. Does anybody have a tip for me? It must
be achieved within one command not more.
Thx
Uwe
--
Joel C. Ewing, Bentonville, AR jcew...@acm.org
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN