The Send Time Message tool allows you to send messages to yourself or
another user based on a time and date. This can be used as a simple
reminder function.
The simplest version of the command is to send a message to yourself
for later on in the same day to attend a meeting such as:
SNDTIMMSG MSG('Go to the Dept meeting')
HR(15) MIN(00)
The SNDTIMMSG command forwards the command to a data queue in the
TAATOOL library. A batch job (in the TIMMSG job) reads the entries
from the data queue and places them in a permanent data base file.
See the later discussion for starting the batch job. The batch job
will wake up when a new entry arrives on the data queue or when a
timeout occurs because it is time to send a message. The TIMMSG
batch job stays in a wait until there is some action to perform.
You can end the TIMMSG job with the command:
ENDTIMMSG
The ENDTIMMSG command sends a special entry to the data queue to
cause the TIMMSG job to end.
SNDTIMMSG is intended for simple one time functions. If you want to
send the same message to yourself everyday, or once a week, use the
system Job Scheduler such as:
ADDJOBSCDE JOB(xxxREMIND)
CMD('Check it out ...')
TOUSR(xxx)
FRQ(*WEEKLY)
SCDTIME(hhmmss)
Getting started
---------------
The CRTTIMMSG command must be used to create the TIMMSGP file in a
library of your choice. The library should be one that you backup
regularly such as QGPL. It cannot be TAATOOL.
CRTTIMMSG LIB(xxx)
The best approach for submitting the batch job is to include the
STRTIMMSG command in your startup job. This ensures the job is
active and can send messages that are due on any day.
Overall use
-----------
SNDTIMMSG is designed to allow multiple users to use the function.
You can send messages for today or any day in the future. You cannot
send a message if the date or time specified is in the past.
When the batch job becomes active, it will immediately send any
messages that are in the past. This would occur if you requested a
message to be sent at a specific date/time and the TIMMSG job was not
active when the date/time occurred.
The batch job will act as an interactive job (mostly waiting for an
action) and therefore the default is to submit the job to the QINTER
job queue.
SNDMSG is used internally to send the messages. This will not cause
a break at the workstation unless the message queue is in break mode.
If any errors occur, the batch program logs the error, sends a note
to QSYSOPR and attempts to keep on running. See the section on Audit
Trail.
The technique of the data queue and the permanent data base file are
used instead of the SBMJOB time function to provide less overhead to
perform a similar function.
Backup considerations
---------------------
The TIMMSGP file must be created in one of your libraries. The file
may contain messages to be sent in the future and you should backup
the file regularly.
When the batch job is active, the TIMMSGP file is open for update and
cannot be saved by the normal SAV functions. You can either use
ENDTIMMSG to end the batch job or the SAVWHLACT option.
The data queue SNDTIMMSG in TAATOOL is used for communications. If
it does not exist when the batch job begins, it is automatically
created.
Cleanup considerations
----------------------
When the batch job becomes active, it first copies the records which
are still active from the TIMMSGP file in the library you specified
to the TIMMSGP2 file in TAATOOL. The TIMMSGP2 file is then copied
back to the TIMMSGP file. Thus the SNDTIMMSG function automatically
cleans up the the file each time the batch job becomes active. There
is no need to reorganize the file to remove deleted records.
Each time the batch job becomes active and first times out from
waiting on the SNDTIMMSG data queue, the data queue is deleted and
then created again. This prevents the exposure of the data queue
becoming too large and never being re-sized.
Authority considerations
------------------------
All the commands are public. The TIMMSGP file is created as *PUBLIC
*USE. The processing programs adopt the use of QSECOFR thus allowing
any user to add or delete records.
When STRTIMMSG cleans out the TIMMSGP file, the CPYF work is done
using a sub program (TAAMSGSC8).
Audit trail
-----------
When an entry arrives on the SNDTIMMSG queue, it is written to the
job log. The entry describes which job entered the request as well
as the request.
If an entry was sent to the data queue and does not contain the
special characters as provided by SNDTIMMSG or ENDTIMMSG, the batch
job continues to run. The error is noted in the job log and a
message is sent to QSYSOPR.
If a SNDMSG command fails when it is executed, the batch program
monitors for the condition and continues to operate. The failure is
noted in the job log and a message is sent to QSYSOPR.
When ENDTIMMSG is used, the batch program determines if any errors
have occurred during the job. If so it forces the job log to be
output by sending an escape message. If the job completes normally,
your JOBD determines if the job log will be output.
CRTTIMMSG Command parameters *CMD
----------------------------
LIB The library to create the TIMMSGP file in.
SRCLIB The source library to use for the QATTDDS file. The
default is *TAAARC which means to use the source in
the TAA Archive.
SNDTIMMSG Command parameters *CMD
----------------------------
MSG The message text to be sent.
HOUR The hour the message should be sent. Military time
is used (01-24) so 3:00 PM should be entered as 15.
The special value ** can be entered to mean the
current time. If the date specified is the current
day, the message will be sent immediately by the
SNDTIMMSG CPP (a message is not sent to the data
queue). If the date specified is not the current
date, the current time values are used with the date
specified.
MIN The minute the message should be sent. The default
is 00. If HOUR(**) is specified, any MIN entry is
ignored.
DATE The date the message should be sent. The default is
*TODAY for the current date. You may specify a date
in job format or use one of the other special values
*DAY1 - *DAY14. *DAY1 means tomorrow, *DAY2 is 2
days from now, etc.
TOUSR The user profile name to have the message sent to.
The default is *CURRENT which means to send the
message to the current user.
STRTIMMSG Command parameters *CMD
----------------------------
LIB The library where the TIMMSGP file exists. The file
must be created with the CRTTIMMSG command.
JOBQ The qualified name of the job queue to be used. The
default is QINTER because the job will act as an
interactive job.
JOBD The qualified name of the job description to be
used. The default is *USRPRF.
ENDTIMMSG Command parameters *CMD
----------------------------
The command has no parameters. It sends a unique entry to the
SNDTIMMSG data queue to end the TIMMSG job.
Restrictions
------------
The batch job TIMMSG must be active to deliver messages at the
correct date/time. A warning message will be sent if you use
STRTIMMSG without having the TIMMSG job active.
Prerequisites
-------------
The following TAA Tools must be on your system:
ADDDAT Add date
CHKAPOST Check apostrophes
RTVJOBSTS Retrieve job status
SNDCOMPMSG Send completion message
SNDDIAGMSG Send diagnostic message
SNDESCMSG Send escape message
SNDSTSMSG Send status message
TAAARC TAA Archive
Implementation
--------------
The tool is ready to use, but you must create the TIMMSGP file with
the command:
CRTTIMMSG LIB(xxx)
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
SNDTIMMSG *CMD TAAMSGS QATTCMD
STRTIMMSG *CMD TAAMSGS2 QATTCMD
ENDTIMMSG *CMD TAAMSGS3 QATTCMD
CRTTIMMSG *CMD TAAMSGS4 QATTCMD
TAAMSGSC *PGM CLP TAAMSGSC QATTCL
TAAMSGSC2 *PGM CLP TAAMSGSC2 QATTCL
TAAMSGSC3 *PGM CLP TAAMSGSC3 QATTCL
TAAMSGSC4 *PGM CLP TAAMSGSC4 QATTCL
TAAMSGSC8 *PGM CLP TAAMSGSC8 QATTCL
TAAMSGSC9 *PGM CLP TAAMSGSC9 QATTCL
TAAMSGSR9 *PGM RPG TAAMSGSR9 QATTRPG
TIMMSGP *FILE PF TAAMSGSP QATTDDS
TIMMSGP2 *FILE
SNDTIMMSG *DTAQ
The TIMMSGP2 file is created in TAATOOL and is used to copy/delete
old records from the TIMMSGP file. The SNDTIMMSG data queue is
automatically created when STRTIMMSG is used.
The SNDTIMMSG *DTAARA is used as an Application Value in TAASECURE
and should be edited with EDTAPPVAL.
Structure
---------
CRTTIMMSG Cmd
TAAMSGSC4 CL pgm
SNDTIMMSG Cmd
TAAMSGSC CL pgm
SNDTIMMSG Data queue
STRTIMMSG Cmd
TAAMSGSC2 CL pgm
Submits the TIMMSG job
TAAMSGSC9 CL pgm
SNDTIMMSG Data queue
TAAMSGSC8 CL pgm
TAAMSGSR9 RPG pgm
TIMMSGP file
ENDTIMMSG Cmd
TAAMSGSC3 CL pgm
SNDTIMMSG Data queue
|