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

Document ID : KB000031134
Last Modified Date : 14/02/2018
Show Technical Document Details


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


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. 
Overdefine 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:

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

3.     Specify old master in, new master out, and the new master will contain converted date fields. 

4.     After execution, delete the L0 statements with names DATEOLDn. 

If the original fields are character, it is likely they are overdefined 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.