>>> My use of IEASYMU2 creates two 'new' system symbols 'PRYYMMDD' and >
'PRYYDDD' after IPL, but then I change the values in those symbols at about
> 00:01 each day.
Sean,
DFSORT can calculate any date in both greogorian and Julian format. A
Simple DATE1-1 will get you yesterday's date in Gregorian format as
CCYYMMDD format and DATE3-1 will get you yesterday's date in Julian format
as CCYYDDD.
Here is a sample to generate various date related symbols
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
SAMPLE
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(DATE1,X,DATE1-1)
OUTFIL BUILD=(C'CURRDATE IN GREGORIAN FORMAT :',DATE1,/,
C'CURRDATE IN JULIAN FORMAT :',DATE3,/,
C'CURRENT DAY OF WEEK :',
01,8,Y4T,WEEKDAY=CHAR9,/,
C'CURRENT WEEK NUMBER IN USA :',
01,8,Y4T,WEEKNUM=USA,/,
C'LASTDAY OF CURRENT WEEK(GREGORIAN) :',
01,8,Y4T,LASTDAYW,TOGREG=Y4T,/,
C'LASTDAY OF CURRENT MONTH(GREGORIAN) :',
01,8,Y4T,LASTDAYM,TOGREG=Y4T,/,
C'LASTDAY OF CURRENT QUARTER(GREGORIAN):',
01,8,Y4T,LASTDAYQ,TOGREG=Y4T,/,
C'LASTDAY OF CURRENT YEAR(GREGORIAN) :',
01,8,Y4T,LASTDAYY,TOGREG=Y4T,/,
C'LASTDAY OF CURRENT WEEK(JULIAN) :',
01,8,Y4T,LASTDAYW,TOJUL=Y4T,/,
C'LASTDAY OF CURRENT MONTH(JULIAN) :',
01,8,Y4T,LASTDAYM,TOJUL=Y4T,/,
C'LASTDAY OF CURRENT QUARTER(JULIAN) :',
01,8,Y4T,LASTDAYQ,TOJUL=Y4T,/,
C'LASTDAY OF CURRENT YEAR(JULIAN) :',
01,8,Y4T,LASTDAYY,TOJUL=Y4T,/,
C'YESTERDAY IN GREGORIAN FORMAT :',DATE1-1,/,
C'YESTERDAY IN JULIAN FORMAT :',DATE3-1,/,
C'YESTERDAY DAY OF WEEK :',
10,8,Y4T,WEEKDAY=CHAR9,/,
C'YESTERDAY WEEK NUMBER IN USA :',
10,8,Y4T,WEEKNUM=USA,80:X)
//*
The output of this is
CURRDATE IN GREGORIAN FORMAT :20181231
CURRDATE IN JULIAN FORMAT :2018365
CURRENT DAY OF WEEK :MONDAY
CURRENT WEEK NUMBER IN USA :53
LASTDAY OF CURRENT WEEK(GREGORIAN) :20190104
LASTDAY OF CURRENT MONTH(GREGORIAN) :20181231
LASTDAY OF CURRENT QUARTER(GREGORIAN):20181231
LASTDAY OF CURRENT YEAR(GREGORIAN) :20181231
LASTDAY OF CURRENT WEEK(JULIAN) :2019004
LASTDAY OF CURRENT MONTH(JULIAN) :2018365
LASTDAY OF CURRENT QUARTER(JULIAN) :2018365
LASTDAY OF CURRENT YEAR(JULIAN) :2018365
YESTERDAY IN GREGORIAN FORMAT :20181230
YESTERDAY IN JULIAN FORMAT :2018364
YESTERDAY DAY OF WEEK :SUNDAY
YESTERDAY WEEK NUMBER IN USA :53
> As for "This is the sort of thing that should be routinely provided by
the
> OS." - a huge YES! to that, and other associated values like 'first
working
> day of the week/month/year' and so on.
> Its a crying shame that the only other way of getting such values in to
a
> jobstream - that I know of! - is by spending $many for something like
CA-7
> or Tivoli.
DFSORT has a plethora of functions that can do what you asked for any given
date.
NEXTDSUN calculates the next Sunday for a date field.
NEXTDMON calculates the next Monday for a date field.
NEXTDTUE calculates the next Tuesday for a date field.
NEXTDWED calculates the next Wednesday for a date field.
NEXTDTHU calculates the next Thursday for a date field.
NEXTDFRI calculates the next Friday for a date field.
NEXTDSAT calculates the next Saturday for a date field.
PREVDSUN calculates the previous Sunday for a date field.
PREVDMON calculates the previous Monday for a date field.
PREVDTUE calculates the previous Tuesday for a date field.
PREVDWED calculates the previous Wednesday for a date field
PREVDTHU calculates the previous Thursday for a date field.
PREVDFRI calculates the previous Friday for a date field.
PREVDSAT calculates the previous Saturday for a date field.
LASTDAYW calculates the last Friday of the week for a date field.
LASTDAYM calculates the last day of the month for a date field.
LASTDAYQ calculates the last day of the quarter for a date field.
LASTDAYY calculates the last day of the year for a date field.
ADDDAYS, ADDMONS or ADDYEARS can be used to add days, months or years to a
date field.
SUBDAYS, SUBMONS or SUBYEARS can be used to subtract days, months or years
from a date field.
DATEDIFF can be used to calculate the number of days between two date
fields.
Check this white paper which explains in detail about the above mentioned
functions along with an example.
ftp://ftp.software.ibm.com/storage/dfsort/mvs/sortugph.pdf
Thanks,
Kolusu
DFSORT Development
IBM Corporation
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN