[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference clt::cobol

Title:VAX/DEC COBOL
Notice:Kit,doc,performance talk info-->DIR/KEY=KIT or DOC or PERF_TALK
Moderator:PACKED::BRAFFITT
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3250
Total number of notes:13077

3160.0. "Year 2000 ?" by ZPAC12::MURALI (Exploring,.. one discovers!! ) Wed Oct 23 1996 01:12

T.RTitleUserPersonal
Name
DateLines
3160.1See DEC COBOL V2.3 User Manual Chapter 1PACKED::BRAFFITTWed Oct 23 1996 09:2329
3160.2Thanks.ZPAC12::MURALIExploring,.. one discovers!! Thu Oct 24 1996 02:033
3160.3TIMA articles on the subjetCSC32::E_VAETHBut She Was Wearing Her Seatbelt!Fri Oct 25 1996 00:497
3160.4TIMA?USDEV::BELKNAPWed Nov 27 1996 19:183
3160.5tima - technical information management architectureCSC32::E_VAETHSuffering from temporary brain cramp, stay tunedTue Dec 03 1996 12:435
3160.6TIMA articlePACKED::BRAFFITTThu Feb 20 1997 15:18183
[COBOL]  How Will The Year 2000 Affect My Applications

     Any party granted access to the following copyrighted information
     (protected under Federal Copyright Laws), pursuant to a duly executed
     Digital Service Agreement may, under the terms of such agreement copy
     all or selected portions of this information for internal use and
     distribution only. No other copying or distribution for any other
     purpose is authorized.
Copyright (c) Digital Equipment Corporation 1996. All rights reserved.

PRODUCT:    DEC COBOL
            VAX COBOL
            Micro Focus COBOL[TM] Compiler and Development Tools
            for Digital[TM] UNIX[R]

OP/SYS:     OpenVMS VAX
            OpenVMS Alpha
            Digital UNIX[R]

SOURCE:     Digital Equipment Corporation



QUESTION:


Will DEC COBOL, VAX COBOL and Micro Focus COBOL compilers have
difficulties when the year 2000 is reached?


ANSWER:

This is primarily an application issue.  The changes, if any, in
applications need to be developed by application programmers. It is
not possible for the COBOL compiler to identify potential trouble
spots, or to correct these applications.

COBOL programmers have access to 2-digit information through the
format 2 ACCEPT FROM (DAY/DATE) statement and 4-digit year information
through various intrinsic FUNCTIONS.  Even if the programs use 4-digit
year information, it is possible that the internal program logic may
use only 2-digit year information.

Similarly, two digit year formats used in controlling fields, or as
keys in indexed files could cause program logic problems as the year
moves from 98, 99 to 00.  COBOL programmers are encouraged to use 4 
digit years instead of 2 digit years in areas where sequential
operations are driven from these values.

COBOL is not a strongly typed language, which means that programs do
not have a requirement to specify the specific nature of use for
fields when they are defined.  Thus data stored in any field may or may
not be dates.  The compiler has no knowledge of the use. Furthermore,
identifiers for fields may be logical references (e.g., PAYROLL-DATE
or DATE-HIRED-YYYY-MMM-DD) however this is not a language requirement
(e.g., PD and DH could have just as easily been specified for the two
identifiers).  Again, the compiler cannot track the use.

DEC COBOL and VAX COBOL provide programmer access to both 4-character
and 2-character year formats:

        4-char  FUNCTION CURRENT-DATE
        4-char  FUNCTION DATE-OF-INTEGER
        4-char  FUNCTION DAY-OF-INTEGER
        4-char  FUNCTION INTEGER-OF-DATE
        4-char  FUNCTION INTEGER-OF-DAY
        4-char  FUNCTION WHEN-COMPILED
        2-char  ACCEPT FROM DATE
        2-char  ACCEPT FROM DAY

DEC COBOL, VAX COBOL and Micro Focus COBOL offer date FUNCTIONs which
could be used in program logic that makes decision about year order,
and the full  4-digit year handled by the 6 FUNCTIONs listed above
should be used in internal program logic decisions around years.
External displays of year information can continue to use 2-digit
formats if that is deemed appropriate for certain application areas.
Therefore, for COBOL applications to gracefully negotiate the year
2000, programmers will need to inspect each application for 2 digit
year dependencies.

Use of ACCEPT does not necessarily mean the program will not handle
the year  2000 transition gracefully, but it should be checked. Use of
two digit years in applications also does not mean that a problem will
exist, but it could. Similarly, use of 4 digit years does not
guarantee success for the millennium transition.  Fields could be
redefined, and the critical comparison may reference a 2 digit portion
of 4 digit date.

The following information has been added to the DEC COBOL User Manual 
V2.3, (AA-Q2G1D-TK) Section 1.7, page 1-58 and 1-59: 

-----------------------------------------------------------------------------
1.7 Special Information For Second Millennium

              The approach of the year 2000 potentially gives rise to
              challenges for programmers in all languages. It is fairly
              safe to say that you are in a position to experience a
              true first. The last time such an issue might have arisen
              would have been around the year 999, and there was an
              indeterminate but probably small number of programmers
              at that time.

              Consider for a moment whether you have written code that
              checks a date by examining the last two bytes of the year,
              or, for that matter, the last three bytes of the year.
              How many of those programs will break at one second past
              midnight on December 31, 1999?

              For decades this was referred to as "the decade issue". Our
              profession is not old enough for it to have been a century-
              or millennium issue. Possibly the first occasion of concern
              came in the late 1960's when programmers short-sightedly
              (and inappropriately) checked 1-digit years. This expedient
              caused application logic problems on January 1, 1970.

              COBOL is not a strongly typed language. COBOL programmers
              are not required to specify the specific nature of use for
              fields when they define those fields. Data stored in any
              field may or may not be a date. Furthermore, identifiers
              for fields may be logical references such as PAYROLL-DATE
              or DATE-HIRED-YYYY-MMM-DD, but this is not a language
              requirement. PD and DH could have just as easily been
              specified for the two identifiers. A compiler cannot track
              intent.

              The changes in applications, if any, must be developed by
              application programmers (like yourself, for instance).
              It is not possible for a compiler -even the DEC COBOL
              compiler, powerful as it is- to identify potential trouble
              spots, or to correct these applications.

              Two-digit year formats used in controlling fields, or
              as keys in indexed files, cause program logic to become
              ambiguous as the year moves from 98, 99 to 00. Simply
              stated, you should use 4-digit years instead of 2-digit
              years in areas where sequential operations are driven from
              these values.

              DEC COBOL provides programmer access to 4-character and
              2-character year formats:

              4-char  FUNCTION CURRENT-DATE

              4-char  FUNCTION DATE-OF-INTEGER

              4-char  FUNCTION DAY-OF-INTEGER

              4-char  FUNCTION INTEGER-OF-DATE

              4-char  FUNCTION INTEGER-OF-DAY

              4-char  FUNCTION WHEN-COMPILED

              2-char  ACCEPT FROM DATE

              2-char  ACCEPT FROM DAY

              DEC COBOL offers date functions which could be used in
              program logic that makes decisions about year order. The
              full 4-digit year handled by the six functions listed above
              should be used in internal program logic decisions that are
              based on years. External displays of year information can
              continue to use 2-digit formats when that is appropriate.

              You should check program logic in code that uses ACCEPT,
              to verify that millennium transition dates dates will be
              properly handled.

              The use of 2-digit years in applications does not
              automatically create a problem, but a problem could exist.
              Similarly, the use of 4-digit years does not guarantee
              success for the millennium transition. For example, fields
              could have been redefined, and the critical comparison
              could reference a 2-digit portion of 4-digit date.

              Basically, for COBOL applications to gracefully and
              successfully make the transit to the year 2000, programmers
              will need to inspect each of their applications for 2-digit
              year dependencies.

              In marked contrast to other material that migrates into
              technical manuals and stays forever, this section will
              disappear after the year 2000.
3160.7For two-digit year-dates, the year 999 was not the last time...PACKED::MASLANKAFri Feb 21 1997 12:0126
Re .6

A paragraph in this article claims that the year 999 was the last time
that the two-digit year-date roll-over problem could have occurred.
Actually this problem could have occurred at the end of 1899. On the 
other hand, if three-digit year dates are being used, the end of the 
year 999 would be the most recent time to encounter the three-digit
year-date roll-over problem. However, three-digit year dates are not
used in current-day calendar keeping, as far as I know.

I suggest that the following amendments be made to this article.

>>>>   1.7 Special Information For Second Millennium

       1.7 Special Information For Year 2000 Arrival

        (The term Second Millenium has been shown to be ambiguous. Some
	 people claim that the Year 2000 is the last year of the second
	 millenium, and others claim that it is the first of the third
	 millenium. But, that has nothing to do with the EDP problems 
	 which are projected for the arrival of the Year 2000.)


>>>>              would have been around the year 999, and there was an

                  would have been around the year 1899, and there was an