>> The date begins in column 1 and is 10 characters long. I know I want to use 
>> the SUBDAYS function. I am looking at the DFSORT Programmer Guide. But I 
>> learn best by example.

Richard,

Your input date has separators and DFSORT date arithmetic functions works on 
date without separators.  So, we just need to strip off the separators and then 
apply the SUBDAYS function.

I assumed your input has RECFM=FB and LRECl=80 and you want to subtract 35 days 
from the input. We first strip off the separators and put that date a temp 
location (81) and then apply the subdays function on that.  Here is a sample.


//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
2024/04/09 - CURR DATE
2024/02/28 - NON LEAP YEAR DATE
2024/02/29 - LEAP YEAR DATE
2007/02/29 - INVALID DATE
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT FIELDS=COPY
  INREC IFOUTLEN=80,
          IFTHEN=(WHEN=INIT,
         OVERLAY=(81:01,10,UFF,M11,LENGTH=8,
                  01:81,8,Y4T,SUBDAYS,+35,TOGREG=(Y4T(/))))
/*

The output from the above is.

2024/03/05 - CURR DATE
2024/01/24 - NON LEAP YEAR DATE
2024/01/25 - LEAP YEAR DATE
********** - INVALID DATE


Note that the last record has an invalid date and that subdays function 
replaced it with asterisks.


Thanks,
Kolusu
DFSORT Development
IBM Corporation



----------------------------------------------------------------------
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