CHKWEEK CHECK DAY OF WEEK TAADATE |
Much of the function of CHKWEEK is replaced by the system Job
Scheduler.
In some environments it is desirable to perform a function on a
specific day of the week (e.g. Monday). For example, assume you
want to perform a fixed set of functions when you signon on Monday
morning. The CHKWEEK command in conjunction with a data area allows
you to easily determine whether to execute the function. Normally,
the CHKWEEK command would be coded within your initial program.
To use the CHKWEEK command you must first create a data area of *CHAR
LEN(6). A value must be placed into the data area for the first day
on which the function should be executed. The data area should be
entered in job date format (assume MMDDYY in this example). If you
want to start performing the function on 12/24/09 enter the value of
'122409'.
The CHKWEEK command has a return variable. The command will return a
'1' value on 12/24/09, 12/31/09, 01/07/10, etc. Because the command
includes a return variable, it can only be executed in a CL program.
When a '1' is returned, the data area is updated. If you do not use
CHKWEEK for several weeks or any time during the week that is past
the date specified, the data area is updated for the most current day
of the week and a '1' is returned.
While the data area is only a 6 position date, the internals of the
command will properly handle the change to a new century.
The typical sequence of commands would be:
DCL &RTNLGL *LGL
.
.
CHKWEEK DTAARA(xxxx) RTNLGL(&RTNLGL)
IF &RTNLGL DO /* Day of week to execute */
.
. /* Your code to execute */
.
ENDDO /* Day of week to execute */
The logical value will be set on only once if the current date is
equal or greater than the data area date. If the command has not
been executed for several weeks, the logical value is set on and the
data area date is set greater than the current date. If the normal
date of execution is on a Monday, but the CHKWEEK command is not
executed until Tuesday, the return variable will be set on Tuesday.
Differences with the system Job Scheduler
-----------------------------------------
The system Job Scheduler function will execute at a fixed time every
week. CHKWEEK allows you to tie the execution of a function to when
you signon or another event occurs.
Command parameters *CMD
------------------
DTAARA The qualified data area which contains the start or
next date. The data area must be defined as *CHAR
LEN(6) and be specified in system date format.
RTNLGL A logical (*LGL) return value where '1' (on)
indicates that the function should be performed.
Prerequisites
-------------
The following TAA Tools must be on your system:
ADDDAT Add date
Implementation
--------------
The tool is ready to use, but you must create a data area to use of
*CHAR LEN(6) and place a beginning date in it.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ----- --------- ---------- -----------
CHKWEEK *CMD TAADATE QATTCMD
TAADATEC *PGM CLP TAADATEC QATTCL
|
Added to TAA Productivity tools April 1, 1995