TCL
archive-accounts command
.mdThe archive-accounts command moves entries from the accounts data level to an archive data level, or optionally deletes them.
Syntax
archive-accounts {<purge_date>} {(d}
Parameter(s)
| <purge_date > | Specifies the date for which all entries created on or before the date will be archived.The date can be expressed in external form (for example, 2/2/22) or in internal form (for example, 19757). If no <purge_date> is provided, then it defaults to the current date and all entries in the accounts data level will be archived. |
(d |
The (d option specifies that all entries resulting from the
specified <purge_date> will not be archived and instead will be
deleted. |
This command helps manage the accounts file. Given the potential importance of tracking which
users were on a system and when, the default behavior is to archive, not delete, entries.
CAUTION: This utility briefly locks the each item in the
dm,accounts, file as it’s processed. Each item corresponds to a user-id
from the dm,users, file. During this time, any users logged on with that
user-id will not be able to logoff from the system or or logto another account.
Developer’s Programming API
The archive-accounts command uses a program-friendly API in the form of a BASIC subroutine. This allows calling the subroutine instead of using an execute statement. The subroutine is dm,bp, archiveAccountsSub and has the following API.
sub archiveAccountsSub(purgeDate, archiving, failed)
Input
purgeDate |
Specifies the date for which all entries created on or before the date will be archived.The date can be expressed in external form (for example, 2/2/22) or in internal form (for example, 19757). The archive is a data level in the accounts file with its name equal to the internal date. If that data level exists then any new entries are appended to the existing entries. |
archiving |
|
Output
failed |
|
Example(s)
The following example archives all entries in dm,accounts, to dm,accounts,<internal date>
archive-accounts
Both of the following examples archive all entries on or before 2/2/22 to dm,accounts,19757.
archive-accounts 2/2/22
archive-accounts 19757
The dm,bp, archive-accounts program itself is an example of using the
archiveAccountsSub() subroutine.