The Add Date 2 command allows a number of days to be added or
subtracted from any date. Both the From date format and the To date
format may be in any of the system supported date types. The command
is useful for determining expiration dates or any other form of
scheduling.
A typical command would be:
DCL &NEWDAT *CHAR LEN(10)
.
ADDDAT2 DAYS(14) NEWDAT(&NEWDAT) NEWDATFMT(*YYMD)
The default is to use the current date. The command would determine
the current date, add 14 to the value and return the date in a
yyyymmdd format. New dates that cross year boundaries are handled
properly including leap years.
A specific From Date may be specified as well as the format of the
date such as:
ADDDAT2 DAYS(14) NEWDAT(&NEWDAT) NEWDATFMT(*YYMD)
FRMDAT(&DATE) FRMDATFMT(*YMD)
Comparison with the ADDDAT tool
-------------------------------
The ADDDAT tool was the original tool. It requires a 6 digit date as
the From Date. When the tool was originally created, it allowed only
a 6 byte return variable. Later the tool was enhanced to allow any
format to be output, by using a second return variable. ADDDAT2
supports any From Date format and any New Date format. Both the From
and New Date values must be specified as character values.
Date ranges supported
---------------------
The ADDDAT2 tool uses the TAA Tool CVTDAT2. This avoids the
restriction of the system CVTDAT command which has a range of 1940 to
2039, or 1928 to 1971 depending on the format used.
CVTDAT2 has a restriction of years 1600 to 4000.
Command parameters *CMD
------------------
DAYS The number of days to add to the From Date. Either
a positive or negative number may be entered to
allow a date further in the future or prior in the
past of the From Date. Zero is valid in which case
the command acts the same as CVTDAT (converts a date
to a different format). The value must be within a
range of 80000 plus or minus.
NEWDAT The new date to be returned. This is a required
return variable that must be specified as *CHAR
LEN(10). Date types such as *MDY are returned
without slashes. Date types such as *USA are
returned with the standard separator character
associated with the type. For example, type *USA
returns a date in the format mm/dd/yyyy.
FRMDAT The From Date to be used as a base for addition or
subtraction. The default is *SYSVAL meaning the
current date taken from the system value (not the
job date). When *SYSVAL is used, the FRMDATFMT
parameter is ignored and the format of the system
value date is used.
*JOB may be specified to mean the job date. A job
date may be changed by the CHGJOB command. When
*JOB is used, the FRMDATFMT parameter is ignored and
the job date format is used.
Any valid date according to the FRMDATFMT may be
entered.
FRMDATFMT The From Date format. The default is *JOB meaning
the date format defined for the job. If
FRMDAT(*SYSVAL) or FRMDAT(*JOB) is specified, the
FRMDATFMT parameter is ignored.
The same values that exist on CVTDAT such as *MDY,
*YYMD, *USA, or *LONGJUL may be entered. For a
complete list, use the prompter facility.
The *JUL2 format allows for dates in a CYYxxx format
where xxx is the day of the year.
NEWDATFMT The New Date format. The default is *JOB or the
setting of the job date format. This may be changed
by a command such as CHGJOB with the DATFMT
parameter.
The same values that exist on CVTDAT such as *MDY,
*YYMD, *USA, or *LONGJUL may be entered. For a
complete list, use the prompter facility.
The *JUL2 format allows for dates in a CYYxxx format
where xxx is the day of the year.
Restrictions
------------
** See the previous comments on date range restrictions.
** Only valid dates may be entered.
Prerequisites
-------------
The following TAA Tools must be on your system:
CVTDAT2 Convert date 2
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
ADDDAT2 *CMD TAADATV QATTCMD
TAADATVC *PGM CLP TAADATVC QATTCL
|