Adding a date-time stamp field

From m204wiki
Revision as of 03:47, 21 March 2013 by Alex (talk | contribs) (Automatically generated page update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

You can add a date-time stamp field to your files to keep track of when records in the file were last modified. The date-time stamp feature lets you put a date-time stamp (DTS) on each record that was updated in a transaction. You can then use the data in the date-time stamp field in an end-user written application to find and process all the rows of data that were changed.

An application that processes these records can track the date-time stamp field values that have been processed to date, or it may take another action, including updating the date-time stamp field.

To install and use this functionality, you must obtain the correct decrypt keys and install this release. After it is installed, the date-time stamp feature works only in files created in V6R1.0 or later.

Note: There is no support in PQO/204 for the date/time stamp feature.

Overview of the date-time stamp feature

The date-time stamp (DTS) feature in Model 204 can track when records are modified. The DTS feature is implemented on a file-by-file basis.

Except for DELETE RECORD(S) processing, all other updates are captured, including those made by BATCH204 and ONLINE jobs.

Precision and accuracy of the date-time stamp is to the millisecond when you use the date-time stamp as delivered. Rocket Software recommends that the date-time stamp field be defined as ORD CHARACTER to accommodate the length of this field: 17 bytes.

The date-time stamp field is updated at the beginning of commit time whenever a new record is stored or an existing record is updated-change, insert, or delete a field.

You can read and display the date-time stamp as you can any other field. User Language and IFAM may both be used to find and display date-time stamp field data.

Extracting date-time stamp field data

Since the date-time stamp field is a normal Model 204 field, all methods of extraction may be used.

Date-time stamp field in User Language

The date-time stamp field may be:

  • Read and printed either as a field name reference or through a $function.
  • Searched in normal FIND statements.
  • Assigned to %variables or other fields.
  • Printed as supported for all Model 204 fields, including a PAI statement.

Date-time stamp field and OPEN processing

If the specified date-time stamp field name is not defined in a date-time stamp file, an OPEN command is rejected. If the date-time stamp field name is DATE.TIMESTAMP, for example, the following messages are issued:

> OPEN DTSFILE *** 1 M204.1265: NO SUCH FIELD NAME. FIELD = DATE.TIMESTAMP *** M204.2730: DATE/TIME STAMP FILE, BUT DTSFN NOT DEFINED IN FILE *** M204.0608: FILE CLOSED: DTSFILE *** 2 M204.0630: FILE OPEN COMMAND REJECTED

If you do not set the DTSFN system parameter, files with FOPT=X'10' cannot be opened. An OPEN command will not be processed and the following message is issued:

M204.2729: DATE/TIME STAMP FILE, BUT DTSFN UNSPECIFIED IN RUN

If you have reset DTS to 0, you must open DTS enabled files with file manager privileges. Otherwise, the open is rejected.

Date-time stamp considerations

Backup and recovery

If any errors occur during processing, the transaction is backed out.

Backup and recovery activity synchronize the date-time stamp with the data changes made. Date-time stamp field updates are part of your updating transaction and follow the normal Model 204 rules for BACKOUT, COMMIT, DUMP, RESTORE, ROLL BACK, and ROLL FORWARD.

File load utilities

FLOD and FASTLOAD do not update the date-time stamp values. However, you can manually update date-time stamp values as you might update another field name value pair.

Procedures with more than one request

If there are two requests in one procedure, for example, and neither COMMIT nor CLOSE is called between the two, then both requests are one transaction.

The following procedure has two requests.

BEGIN STORE a record in a DTS file END BEGIN PAI the record END

DTS updates are not displayed by the PAI output, since the transaction does not complete until the end of the procedure.

If there is no COMMIT in the first request or if the file is not closed after the first request, then the date-time stamp field is not updated.

If the same User Language requests are executed as separate procedures, the date-time stamp field is updated.

Suspending date-time stamp updates

A user with system manager privileges can exclude date-time stamp files from DTS processing, suspending DTS updates for that user's thread. The user's thread does no date-time stamp processing on any file.

To suspend DTS updates, reset the DTS parameter to 0. When DTS=0, the user can update any field, including the date-time stamp field, without automatically updating the date-time stamp field.

To reset the DTS parameter, the user must have system manager privileges. The user must also have file manager privileges for any DTS-enabled files opened, either before or after DTS is reset to 0.

Note: Automatic date-time stamp field updates are still performed for updates made to the files by other user threads with DTS set to 1.

To disable all date-time stamp processing for a specific file, turn off the FOPT parameter X'10' bit on the command line or using the File Management Subsystem facility. Turning off this bit disables date-time stamp updates made by all users of that file.

For more information on the DTS and FOPT parameters, see the Rocket Model 204 Parameter and Command Reference.