Download Suprtool 5.4 for HP-UX
Transcript
>if field=$today
>if field=$today(-1)
>if field=$today(+1)
{today's date}
{yesterday's date}
{tomorrow's date}
Use the Item command to qualify the field as a date. The $today function accepts one
optional argument which is the number of days before or after today. The maximum
number of days in either direction is 9999.
yymmdd and Beyond 1999
Because dates spanning the turn of the century will not collate properly for the
yymmdd form, you need to use $stddate to compare these dates.
>item ship-date,date,yymmdd
>if ship-date < $date(2000/12/31)
>if $stddate(ship-date) < $date(2000/12/31)
{will not work}
{will work}
Finding Invalid Dates
Use the $invalid function to find invalid dates. An invalid date is a number in a date
format whose date equivalent cannot be found on a calendar. For example, a month
value of 99 would be considered invalid.
>input sdfile
>item deliv-date,date,ccyymmdd
>if $invalid(deliv-date)
>out baddates,link
>xeq
{a self-describing file}
$Stddate Function
The $stddate function converts any date format in nearly any data-type container and
internally converts it to the ccyymmdd format in a double integer container.
This allows you to compare dates with dissimilar formats and data-types. For
example,
>in orddets
>item order-date,date,ccyymmdd
>item bill-date,date,mmddyyyy
>if $stddate(bill-date) <= order-date
>output badords,link
>xeq
This feature is also available for dates that have two-digit years. The century portion
of the date will be generated by $stddate, which uses the normal cutoff rules
specified by Set Date Cutoff.
>in invdets
>set date cutoff 20
>item invoice-date,date,yymmdd
>item close-date,date,mmddyyyy
>if $stddate(close-date) <= $stddate(invoice-date)
>out badinvs,link
>xeq
In this case all invoice-date values with a yy portion between 20 and 99 will have a
19 for the century. All invoice date values with a yy portion of less than 20 will have
20 for the date generated by the $stddate function.
Invalid Dates
A date must be valid before $stddate can convert it to the ccyymmdd format.
Otherwise, a value of 0 will be returned for any invalid dates. An invalid date is a
Suprtool 5.4 for HP-UX
Suprtool Commands • 151