Syntax
DATECONVERT { TODAYNUMBER | TODATE | TOALPHA } variable [ GS status]
Parameters
DateConvert can be abbreviated as DC.
TODAYNUMBER
Converts the following date variable to a relative day number, and stores the result in Glb.Total.
TODATE
Converts the relative day number from Glb.Total to a date, and stores the result in the following date variable.
TOALPHA
Converts the relative day number from Glb.Total to a date, and stores the result in the following date variable.
variable
A string-primitive or number-primitive variable. For both the ToDate and ToAlpha command options, the primitive of this variable determines the format of the result date.
GS status
Indicates an invalid date using the specified variable.
Description
The simple form of the DateConvert logic command converts the Glb.Total built-in segment attribute as either the source or destination of a relative day number, based upon the fixed date of January 1, 1957. If a base year other than 1957 is required, the DateConvert complex form should be used. The DateConvert simple form does not provide correct conversions for dates from the year 2057 (more than 100 years after the base year).
Failure behavior
If the date is invalid, the Glb.Status built-in segment attribute is set to "*****". Use the GS command option to direct the result to a variable. Error testing should be used whenever the DateConvert logic command is invoked.
Restrictions
The following restrictions apply to the simple form of the DateConvert logic command:
8-digit dates are not valid.
National string-primitive characters are not valid.
Handling of signed numbers in group variables by the DateConvert logic command depends on the compiler implementation. Number-primitive variables within a group variable should be unsigned.
The relative day number is the number of days after the base date (1/1/1957). Conversion of relative day number is limited to a maximum of 999999 days, starting from 1 January of the base year. The relative day number of January 1 of the base year is 0.
Example
This example converts Birth_Date into a relative day number. The result is stored in the Glb.Total built-in segment attribute, and the value of the GS command option in SDError.
DateConvert ToDayNumber Birth_Date GS SDError