|
Converting the 2 digit year in HIRE_DATE to a 4 digit year uses a 100 year span beginning with 1996. But any conversions involving the RETIRE_DATE field will use a 100 year span beginning with 1950.
|
|
Old Dates vs. New Dates
FOCUS is a rich 4GL in its ability to describe and format datatypes. It allows formatting options such as YMD to be appended to alphanumeric and integer datatypes. These fields are coded as FIELD=xxx,yyy,A6YMD,$ or FIELD=xxx,yyy,I6YMD,$. Internally these values are stored in the database as an alphanumeric 6 byte and integer 4 byte field. When displayed they will have a "/" after every two positions. So both datatypes can represent date information in a report or as input to a MAINTAIN/MODIFY procedure. These types of formats may also be referred to as old dates'.
Conversely a FOCUS new date' field is really an integer date which is the number of days since December 31, 1900. It is stored in the database as a 4 byte integer. This makes it very simple to calculate the number of days between two dates, or find the date a given number of days before or after a given date.
When determining the scope of your date problem, any field formats coded with a new date format don't pose a problem for date arithmetic. You may have display problems if your new date format uses a 2 digit year, FORMAT=YMD,$. But this problem can also be solved by converting from a 2 to 4 digit year. You will certainly face most of your problems with those ambiguous dates that a search doesn't turn up. Fields that are formatted as alphanumeric 6 bytes or integer 6 bytes which contain date information. How will you know that they contain date information without referencing them directly.
In Mainframe FOCUS release 7.0.6 we introduce an expanded version of the sliding window technique. File and field level settings of DEFCENT and YRTHRESH may be coded in your MFD or directly in DEFINE/COMPUTE statements. This creates much more flexibility in isolating date conversions on a per file or per field level basis. So your 100 year span may slide based upon where the setting is coded.
At the MFD or file level, new syntax has been added:
FDEFCENT=nn
{FDFC}=nn
|
FYRTHRESH=nn
{FYRT}=nn
|
These file level settings are coded in line one of your MFD immediately following
FILE= ,SUFFIX= ,
For Example:
FILE=MYDATE,SUFFIX=FOC,FDFC=19,FYRT=96,$
SEGNAME=ONE,SEGTYPE=S1,$
FIELD=SSN,SSN,I9,$
FIELD=FIRST_NAME,FN,A10,$
FIELD=LAST_NAME,LN,A15,$
FIELD=HIRE_DATE,HD,I6YMD,$
At the field level, new syntax has been added:
DFC=nn YRT=nn
These field level settings are coded immediately following your FORMAT= , statement.
FILE=MYDATE,SUFFIX=FOC,FDFC=19,FYRT=96,$
SEGNAME=ONE,SEGTYPE=S1,$
FIELD=SSN,SSN,I9,$
FIELD=FIRST_NAME,FN,A10,$
FIELD=LAST_NAME,LN,A15,$
FIELD=HIRE_DATE,HD,I6YMD,$
FIELD=RETIRE_DATE,RD,I6YMD,DFC=19,YRT=50,$
Converting the 2 digit year in HIRE_DATE to a 4 digit year uses a 100 year span beginning with 1996. But any conversions involving the RETIRE_DATE field will use a 100 year span beginning with 1950.
For DEFINE and COMPUTE statements, new syntax has been added:
DEFINE/COMPUTE fld/fmt DFC nn YRT nn = expression;
Like the field level settings, DFC nn YRT nn must be coded immediately following the field format.
Our earlier example using DEFINE and the global settings of DEFCENT and YRTHRESH may now be expanded to:
DEFINE FILE MYDATE
EBHIRE_DATE/YYMD DFC 19 YRT 96 = HIRE_DATE;
EBRETIRE_DATE/YYMD DFC 19 YRT 50 = HIRE_DATE;
END
If you need to use a COMPUTE field which acts on the results of the retrieved and possibly aggregated records, your TABLE request can be coded:
TABLE FILE MYDATE
PRINT FN LN AND COMPUTE
EBRETIRE_DATE/YYMD DFC 19 YRT 50 = HIRE_DATE;
END
So you see that the Date Problem involves not only how you use dates in existing applications but how you manage them for the future. This is a planning and management problem that faces us all.
Choices must be made not only for your FOCUS applications but all code used in your shop. The clock is ticking so what are you waiting for?
Peter Kruskopfs is currently the IBM MF FOCUS Product Manager with Information Builders.
He has been with IBI for eight years. His previous position was Manager of IBM Systems
in Customer Support Services. Peter graduated cum laude from Marist College with a B.S.
in Computer Science.
|