USS "date" command, subtract one day

2013-03-14 Thread Uwe Oswald
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 everythi

Re: USS "date" command, subtract one day

2013-03-14 Thread Kirk Wolf
You should probably ask your question on the mvs-oe list: http://www.lsoft.com/scripts/wl.exe?SL1=MVS-OE&H=VM.MARIST.EDU I don't know how to do this with a shell command, I think that you would have write a program. If your system has IBM Ported Tools perl, then that would work (google "perl da

Re: USS "date" command, subtract one day

2013-03-14 Thread John McKown
Don't use the UNIX date command. If IBM had ported the GNU version, it would be easy. What I do is use REXX. A UNIX REXX shell script is rather easy: /* rexx */ today=date('b') /* today's date in base form */ yesterday = today - 1 say date('s',yesterday,'b') /* yesterday in mmdd form */ Ref f

Re: USS "date" command, subtract one day

2013-03-14 Thread John Gilmore
Uwe, You can package anything as your own 'single' command, but the only sensible way to do what you want to do is to convert your year-month-day Gregorian-calendar date into a day number, subtract one, and convert the difference back into a year-month-day value. There are library routines that p

Re: USS "date" command, subtract one day

2013-03-14 Thread Rafal Hanzel ZETO Katowice
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 Elektronic

Re: USS "date" command, subtract one day

2013-03-14 Thread Elardus Engelbrecht
John McKown wrote: >What I do is use REXX. A UNIX REXX shell script is rather easy: Agreed. REXX can do things an achieve results in one single command line. Use the pipe thing to send and receive keywords/parms to different commands. >/* rexx */ >today=date('b') /* today's date in base form */

Re: USS "date" command, subtract one day

2013-03-14 Thread Steve Comstock
On 3/14/2013 7:10 AM, Elardus Engelbrecht wrote: John McKown wrote: What I do is use REXX. A UNIX REXX shell script is rather easy: Agreed. REXX can do things an achieve results in one single command line. Use the pipe thing to send and receive keywords/parms to different commands. /* rexx

Re: USS "date" command, subtract one day

2013-03-14 Thread Paul Gilmartin
On Thu, 14 Mar 2013 07:13:11 -0500, Kirk Wolf wrote: > >I was thinking that another path might be to write a shell script in REXX >and use the Unix syscalls. But the one you really need, mktime(), isn't >listed in the "Using REXX with Unix System Services". Pity, that would >have been quite doabl

AW: USS "date" command, subtract one day

2013-03-14 Thread Uwe Oswald
anzel 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,

Re: USS "date" command, subtract one day

2013-03-14 Thread Elardus Engelbrecht
Steve Comstock wrote: >If you're coding in C, Assembler, COBOL, or PL/I, you can use the Language >Environment date functions, which can do what you want pretty simply. It is pretty easy indeed. I have done that in REXX and COBOL to test out date/time functions before and after we converted to u

Re: USS "date" command, subtract one day

2013-03-14 Thread Rafal Hanzel ZETO Katowice
en 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, subt

Re: USS "date" command, subtract one day

2013-03-14 Thread Kirk Wolf
See the little c program below that displays dates after applying your favorite offset. mktime() and strftime() do all of the heavy lifting. example: *> dateoff -d -1 -h -1 "%Y/%m/%d %H:%M:%S" * 2013/03/13 14:20:33 (display the local time l

Re: USS "date" command, subtract one day

2013-03-15 Thread Joel C. Ewing
oesn’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@LIST

Re: USS "date" command, subtract one day

2013-03-15 Thread Paul Gilmartin
On Fri, 15 Mar 2013 09:36:41 -0500, Joel C. Ewing wrote: >Are there semantic rules in shell scripts covering whether multiple >usages of "date" return consistent values (as there are for date/time >functions within a single REXX statement)? If not, any script with No. But the format string for

Re: USS "date" command, subtract one day

2013-03-15 Thread Joel C. Ewing
On 03/15/2013 10:29 AM, Paul Gilmartin wrote: On Fri, 15 Mar 2013 09:36:41 -0500, Joel C. Ewing wrote: single date. For example, if consistency is not guaranteed, the test for day "01" may run while the date is last day of month, and subsequent code which presumes "not day 01" may run aft

Re: AW: USS "date" command, subtract one day

2013-03-14 Thread Joel C. Ewing
01 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" com

Re: AW: USS "date" command, subtract one day

2013-03-14 Thread Mark Zelden
If you do it in REXX, as already mentioned, the DATE builtin function can convert between most formats (not all). It's has that ability since OS/390 2.4. If you don't like that you can use the RDATE or RDATEF (called as a function) from my web site or CBT file 434. It has it's own "base da

Re: AW: USS "date" command, subtract one day

2013-03-14 Thread Paul Gilmartin
On Thu, 14 Mar 2013 11:15:20 -0500, Joel C. Ewing wrote: > >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. > I believe that any option introduced by two hyphens is a GNUism; not POS

Re: AW: USS "date" command, subtract one day

2013-03-14 Thread Sri h Kolusu
RT Development IBM Corporation Email: skol...@us.ibm.com Phone: 408-463-2403 Tie Line 543-2403 IBM Mainframe Discussion List wrote on 03/14/2013 09:38:02 AM: > From: Mark Zelden > To: IBM-MAIN@listserv.ua.edu, > Date: 03/14/2013 09:38 AM > Subject: Re: AW: USS "date" comm

Re: AW: USS "date" command, subtract one day

2013-03-14 Thread Paul Gilmartin
On Thu, 14 Mar 2013 11:38:02 -0500, Mark Zelden wrote: >If you do it in REXX, as already mentioned, the DATE builtin function can >convert >between most formats (not all). It's has that ability since OS/390 2.4. If >you >don't like that you can use the RDATE or RDATEF (called as a function)

AW: AW: USS "date" command, subtract one day

2013-03-14 Thread Uwe Oswald
el 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,

Re: AW: USS "date" command, subtract one day

2013-03-14 Thread zMan
On Thu, Mar 14, 2013 at 1: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. I'd never tell someone "You don't want to do it that way, do it THIS way", but I don't under

Re: AW: AW: USS "date" command, subtract one day

2013-03-14 Thread Joel C. Ewing
n: 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, i

Re: AW: AW: USS "date" command, subtract one day

2013-03-14 Thread Joel C. Ewing
e...--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 1

Re: AW: AW: USS "date" command, subtract one day

2013-03-14 Thread Paul Gilmartin
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.

Re: IBM-MAIN Digest - 13 Mar 2013 to 14 Mar 2013 (#2013-73) USS "date" command, subtract one day

2013-03-15 Thread William Schoen
Another rexx example using the system's time zone /* rexx yesterdy */ call syscalls 'ON' numeric digits 10 cvt=storage(10,4) cvttz=storage(d2x(c2d(cvt)+304),4) tz=format(c2d(cvttz,4)*1.048576,,0) address syscall 'time' address syscall 'gmtime' retval-86400+tz 'tm.' say tm.tm_year''right(tm.tm_

Re: IBM-MAIN Digest - 13 Mar 2013 to 14 Mar 2013 (#2013-73) USS "date" command, subtract one day

2013-03-15 Thread Elardus Engelbrecht
William Schoen wrote: >Another rexx example using the system's time zone Thanks. Your example is indeed fast and furious! ;-D >tz=format(c2d(cvttz,4)*1.048576,,0) Any background info about this magic number 1.048576? Thanks again. This one I will keep forever. ;-D Groete / Greetings Elardus E

Re: IBM-MAIN Digest - 13 Mar 2013 to 14 Mar 2013 (#2013-73) USS "date" command, subtract one day

2013-03-15 Thread Paul Gilmartin
On Fri, 15 Mar 2013 10:25:16 -0500, Elardus Engelbrecht wrote: > >Any background info about this magic number 1.048576? > In an IBM Redbook, IIRC, this coeffecient was once called, repugnantly, a megamicroseond. This could be justified, again repugnantly, by terminology in IBM glossaries. -- gil

Re: IBM-MAIN Digest - 13 Mar 2013 to 14 Mar 2013 (#2013-73) USS "date" command, subtract one day

2013-03-15 Thread Elardus Engelbrecht
Paul Gilmartin wrote: >In an IBM Redbook, IIRC, this coeffecient was once called, repugnantly, a >megamicroseond. This could be justified, again repugnantly, by terminology in IBM glossaries. Thanks for your magic comment. I finally found it by using mega-microsecond as a search argument. htt

Re: IBM-MAIN Digest - 13 Mar 2013 to 14 Mar 2013 (#2013-73) USS "date" command, subtract one day

2013-03-15 Thread Kirk Talman
deja vu all over agian http://www.mail-archive.com/ibm-main@bama.ua.edu/msg86982.html IBM Mainframe Discussion List wrote on 03/15/2013 11:33:44 AM: > From: Paul Gilmartin > > On Fri, 15 Mar 2013 10:25:16 -0500, Elardus Engelbrecht wrote: > > > >Any background info about this magic number 1.

Re: IBM-MAIN Digest - 13 Mar 2013 to 14 Mar 2013 (#2013-73) USS "date" command, subtract one day

2013-03-15 Thread Joel C. Ewing
Of course in light of unit standards that have been in effect since 1998, the correct terminology would be to refer to the unit's position of the high-order word of the TOD as corresponding to a "mebimicrosecond" to correctly convey the [still repugnant] mix of binary and decimal multipliers.