Convert 2 digit year to 4 digit with VISION:Builder
search cancel

Convert 2 digit year to 4 digit with VISION:Builder

book

Article ID: 31134

calendar_today

Updated On:

Products

Vision:Builder

Issue/Introduction

How can I convert 2 digit year to 4 digit with VISION:Builder?

Resolution

Dates in user data that have 2 digit years can be easily converted to 4 digit year format. 

Using the VISION:Builder DATE field type, the century can be added to numeric format (zoned or packed), date fields without taking any more storage or rearranging other fields in the file definition.  If the original fields are numeric format, no changes need be made to the application. 

  1. Change the file definition L0 statements for old date field to rename them to DATEOLDn. 
    Over define the old date field with a new field with the original name, using field type D, length 4.
  2. Create a simple application with the following procedure:

                              CONVDATEER
                             ##PROC
                             LET O.originalname = O.DATENEWn + 190000
                                             (repeat this LET statement for each date field)
                             ##PEND

  1. Specify old master in, new master out, and the new master will contain converted date fields. 
  2. After execution, delete the L0 statements with names DATEOLDn. 

If the original fields are character, it is likely they are over defined with the YY MM DD components and/or partial fielding is used in the application.  If you use the above procedure, applications will need to be modified to move the new date field to a temporary character field before partial fielding is allowed and field qualifiers must be changed to T.