If you are planning to perform the date arithmetic on z/OS then DFSORT has 
many Date arithmetic functions that can add/subtract days, months and 
years from any given date. 

If you just want the current date-1 when you can use DATE1-1 

//STEP0100 EXEC PGM=SORT 
//SYSOUT DD SYSOUT=* 
//SORTIN DD * 
ABC 
//SORTOUT DD SYSOUT=* 
//SYSIN DD * 
  OPTION COPY 
  INREC OVERLAY=(10:DATE1-1) 
//* 

The output from this 

ABC      20130313 

But if you want add/sub days from any given date, then you can use the 
following DFSORT Job

//STEP0100 EXEC PGM=SORT 
//SYSOUT DD SYSOUT=* 
//SORTIN DD * 
20101215 
20110110 
20110225 
//SORTOUT DD SYSOUT=* 
//SYSIN DD * 
  OPTION COPY 
  INREC OVERLAY=(15:1,8,Y4T,ADDDAYS,+15,TOGREG=Y4T(-), 
                 30:1,8,Y4T,SUBDAYS,+23,TOGREG=Y4T(-)) 
//*

The output is 

20101215      2010-12-30     2010-11-22
20110110      2011-01-25     2010-12-18
20110225      2011-03-12     2011-02-02  


For complete details of date arithmetic functions and other new functions 
see "User Guide for DFSORT PTFs UK90025 and UK90026" paper (sortugph.pdf) 
at:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242

Thanks,
Sri Hari Kolusu
DFSORT Development
IBM Corporation
Email: skol...@us.ibm.com
Phone: 408-463-2403 Tie Line 543-2403

IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu> wrote on 
03/14/2013 09:38:02 AM:

> From: Mark Zelden <m...@mzelden.com>
> To: IBM-MAIN@listserv.ua.edu, 
> Date: 03/14/2013 09:38 AM
> Subject: Re: AW: USS "date" command, subtract one day
> Sent by: IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu>
> 
> 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 date" based on 1/1/1900 that I use in programs
> for subtracting or adding days. 
> 
> http://www.mzelden.com/mvsfiles/rdate.txt
> 
> --
> Mark Zelden - Zelden Consulting Services - z/OS, OS/390 and MVS 
> mailto:m...@mzelden.com 
> Mark's MVS Utilities: http://www.mzelden.com/mvsutil.html 
> Systems Programming expert at http://expertanswercenter.techtarget.com/
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
> 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to