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.

Example: Using the DATE NEW Subcommand

The following example illustrates using the DATE NEW subcommand interactively.

rebuild
Enter option
 1. REBUILD           (Optimize the database structure)
 2. REORG             (Alter the database structure)
 3. INDEX             (Build/modify the database index)
 4. EXTERNAL INDEX    (Build/modify an external index database)
 5. CHECK             (Check the database structure)
 6. TIMESTAMP         (Change the database timestamp)
 7. DATE NEW          (Convert old date formats to smartdate formats)
 8. MDINDEX           (Build/modify a multidimensional index)
> date new
DATE NEW
ENTER THE NAME OF THE MASTER
> employee
ENTER THE NEW NAME FOR THE MASTER
> newemp
HAVE YOU BACKED UP THE DATABASE? (YES,NO)
> yes
>   NUMBER OF ERRORS=     0
 NUMBER OF SEGMENTS=  11  ( REAL=    6  VIRTUAL=   5 )
 NUMBER OF FIELDS=    34  INDEXES=   1  FILES=     3
 TOTAL LENGTH OF ALL FIELDS=  365
HOLDING...
.
.
.
NUMBER OF SEGMENTS CHANGED=      107

In z/OS, the new Master File is written to ddname HOLDMAST. After the new Master File is created, you should immediately copy it to a permanent data set.

For example:

DYNAM COPYDD HOLDMAST(NEWEMP) MASTER(NEWEMP)

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.

Reference: DATE NEW Usage Notes

  • The DBA password for the data source must be issued prior to issuing REBUILD.
  • The original Master File cannot be encrypted.
  • All files must be available locally during the REBUILD, including LOCATION files.
  • The Master File cannot have GROUP fields.
  • Some error numbers are available in &FOCERRNUM while all error numbers are available in &&FOCREBUILD. Test both &&FOCREBUILD and &FOCERRNUM for errors when writing procedures to rebuild your data sources.
  • To avoid any potential problems, clear all LETs and JOINs before issuing REBUILD.
  • DEFCENT/YRTHRESH are respected at the global, data source, and field level.
  • Correct all invalid date values in the data source before executing REBUILD/DATE NEW. The utility converts all invalid dates to zero. Invalid dates used as keys may lead to duplicate keys in the data source.
  • Adequate workspace must be available for the temporary REBUILD file. As a rule of thumb, have space 10 to 20% larger than the size of the existing file available.
  • REBUILD/INDEX is performed automatically if an index exists.
  • REBUILD/REBUILD is performed automatically after REBUILD/DATE NEW when any key is a date.
  • Sort libraries and work space must be available (as with REBUILD/INDEX). The REBUILD allocates default sort work space if you have not already. DDNAMEs SORTIN and SORTOUT must be allocated prior to issuing a REBUILD.

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:

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:

  • The SEGTYPE changes from an S2 to S3 to incorporate a 2-byte pad field.
  • Format A6YMD changes to smart date format YMD.
  • A 2-byte pad field with a blank field name and alias is added to the Master File.
  • Format I6MDY changes to smart date format MDY (no padding needed).
  • Format A8YYMD changes to smart date format YYMD.
  • A 4-byte pad field with a blank field name and alias is added to the Master File.

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.


Information Builders