Converting Legacy Dates: The DATE NEW Subcommand

In this section:

The REBUILD subcommand DATE NEW converts legacy dates (alphanumeric, integer, and packed-decimal fields with date display options) to smart dates (fields in date format) in your FOCUS data sources.

The utility uses update-in-place technology. It updates your data source and creates a new Master File, yet does not change the structure or size of the data source. You must back up the data source before executing REBUILD with the DATE NEW subcommand. We recommend that you run the utility against the copy and then replace the original file with the updated backup.


Top of page

x
How DATE NEW Converts Legacy Dates

Reference:

REBUILD DATE NEW subcommand overwrites the original legacy date field (an alphanumeric, integer, or packed-decimal field with date display options) with a smart date (a field in date format). When the storage size of the legacy date exceeds four bytes (the storage size of a smart date), a pad field is added to the data source following the date field:

When a date is a key field (but not the last key for the segment), and it requires a pad field, the number of keys in the SEGTYPE is increased by one for each date field that requires padding.

DATE NEW only changes legacy dates to smart dates. The field format in the Master File must be one of the following (month translation edit options T and TR may be included in the format):

A8YYMD A8MDYY A8DMYY A6YMD A6MDY A6DMY A6YYM A6MYY A4YM A4MY
I8YYMD I8MDYY I8DMYY I6YMD I6MDY I6DMY I6YYM I6MYY I4YM I4MY
P8YYMD P8MDYY P8DMYY P6YMD P6MDY P6DMY P6YYM P6MYY P4YM P4MY

If you have a field that stores date values but does not have one of these formats, DATE NEW does not change it. If you have a field with one of these formats that you do not want changed, temporarily remove the date edit options from the format, run REBUILD DATE NEW, and then restore the edit options to the format.



x
Reference: DATE NEW Usage Notes

Top of page

x
What DATE NEW Does Not Convert

The REBUILD DATE NEW subcommand is a remediation tool for your FOCUS data sources and date fields only. It does not remediate:



Example: Using the DATE NEW Subcommand in Windows

The following procedure:

1. SET DFC = 19, YRT = 50 
2. REBUILD 
3. DATE NEW 
4. NEWEMP.MAS 
5. YES
  1. Sets the DEFCENT and YRTHRESH parameters that determine which century to use for each date.
  2. Initiates the REBUILD facility.
  3. Specifies the DATE NEW subcommand.
  4. Provides the name of the Master File that specifies the dates to convert.
  5. Indicates that the data source has been backed up.

The dates will be converted and the appropriate statistics will be generated, including the number of segments changed.

The new Master File is an updated copy of the original Master File except that:


Top of page

x
Using the New Master File Created by DATE NEW

REBUILD DATE NEW subcommand creates an updated Master File that reflects the changes made to the data source. Once the data source has been rebuilt, the original Master File can no longer be used against the data source. You must use the new Master File created by the DATE NEW subcommand.



Example: Sample Master File: Before and After Conversion by DATE NEW

Before Conversion

After Conversion

FILE=filename
FILE=filename
SEGNAME=segname, SEGTYPE=S2
SEGNAME=segname, SEGTYPE=S3
FIELD=KEY1,,USAGE=A6YMD,$
FIELD=KEY1,,USAGE= YMD,$
FIELD=, ,USAGE=A2,$ PAD FIELD 
ADDED BY REBUILD
FIELD=KEY2,,USAGE=I6MDY,$
FIELD=KEY2,,USAGE= MDY,$
FIELD=FIELD3,,USAGE=A8YYMD,$
FIELD=FIELD3,,USAGE= YYMD,$
FIELD=, ,USAGE=A4,$ PAD FIELD 
ADDED BY REBUILD

When REBUILD DATE NEW subcommand converts this Master File:



x
Action Taken on a Date Field During REBUILD/DATE NEW

REBUILD/DATE NEW performs a REBUILD/REBUILD or REBUILD/INDEX automatically when a date field is a key or a date field is indexed. The following chart shows the action taken on a date field during the REBUILD/DATE NEW process.

Date Is a Key

Index

Result

No

None

NUMBER OF SEGMENTS CHANGED = n

No

Yes

REBUILD/INDEX on date field.

Yes

None

REBUILD/REBUILD is performed.

Yes

On any field

REBUILD/REBUILD is performed.

REBUILD/INDEX is performed for the indexed fields.


WebFOCUS