home *** CD-ROM | disk | FTP | other *** search
/ ftp.robelle3000.ai 2014 / 2014.06.ftp.robelle3000.ai.tar / ftp.robelle3000.ai / faq / g8.txt < prev    next >
Text File  |  1997-02-13  |  16KB  |  462 lines

  1.  
  2. SUBJECT: Robelle Software and 'Year 2000'
  3.  
  4.  
  5. We rebooted our test cpu with a date of Dec 31, 1999 and watched it
  6.   roll over into the next millennium. We then subjected our software to
  7.   rigorous regression testing. The whole test suite ran without any
  8.   failures.
  9.  
  10.  
  11. Qedit, our text editor should have no problems with dates beyond Dec 31,
  12.   1999.  "Set X" can already tag Cobol source files with 8 character dates
  13.   and the list command prints the century as part of the time stamp on the
  14.   heading line.
  15.  
  16.  
  17. Xpress, our email package, supports full Year-2000 compliant dates,
  18.   starting with version 3.1.06.
  19.  
  20.  
  21. Suprtool, our database handyman, has supported date types with centuries
  22.   since 1987, starting in version 2.9.  If you are storing your dates with
  23.   4 digit years, you should have no problems.
  24.  
  25.  
  26. Two-Digit Years
  27.  
  28.   Currently  the  date format of YYMMDD collates (sorts) correctly if the date
  29.   is not beyond  December  31,  1999.   Given  the  current  date  is  961210,
  30.   numerically this is less than next year whose date value is 971210.
  31.  
  32.   At  the  turn  of  the  century dates in the yymmdd format (or yymm) will no
  33.   longer sort correctly because the value of December  10,  2000  (001210)  is
  34.   less than 961210.
  35.  
  36.   Consequently,  if  we  have  a  date beyond 1999, stored in YYMMDD format, a
  37.   relative operation such as
  38.  
  39.       >if date-field >= $date(96/12/10)
  40.  
  41.   will not find the date of December 10, 2000.
  42.  
  43.  
  44.  
  45. If Command and Year 2000
  46.  
  47.   Because dates beyond 1999 will not collate properly for the YYMMDD
  48.   format, starting in version 4.0, the If command will produce an
  49.   error if the year specified in a $date or $today function is
  50.   greater than 1999 and the date format is YYMMDD or YYMM, and we are
  51.   performing a relative operation, e.x., greater than.
  52.  
  53.  
  54.  
  55. Set Date Cutoff
  56.  
  57.   Before version 4.0 Suprtool would assume 19 for the century for any
  58.   user-specified $date with a two-digit year.
  59.  
  60.   For example:
  61.  
  62.       >item date-field,date,ccyymmdd
  63.       >if date-field <= $date(09/12/26)
  64.  
  65.   Previously the $date function would convert the user specified $date to
  66.  
  67.       1909/12/26
  68.  
  69.   in order for it to be compared to the date-field format  of  CCYYMMDD.   Now
  70.   with  Set Date Cutoff xx, we assume 20 for the century if the year specified
  71.   in the $date function is less than the value of Set Date Cutoff.
  72.  
  73.   For example:
  74.  
  75.       >set date cutoff 10
  76.       >item date-field,date,ccyymmdd
  77.       >if date-field <= $date(09/12/26)
  78.  
  79.   Suprtool in this case assumes the full $date to be:
  80.  
  81.       2009/12/26
  82.  
  83.   Conversely if the value of Set Date Cutoff was 5, then the  assumed  century
  84.   would be 19.
  85.  
  86.   The default value of Set Date Cutoff is 10.
  87.  
  88.  
  89.  
  90. Set Date ForceCentury
  91.  
  92.   Set Date ForceCentury On will not allow a yy date to be entered in the $date
  93.   function, it will force the user to enter a full ccyy date.
  94.  
  95.      >set date forcecentury on
  96.      >item date-field,date,ccyymmdd
  97.      >if date-field >= $date(96/12/10)
  98.  
  99.    Error:You must specify the century or Set Date ForceCentury off
  100.  
  101.   The default value for Set Date ForceCentury is off.
  102.  
  103.  
  104. AAMMDD Date Format
  105.  
  106.   The AAMMDD date format was developed by James Overman of HP for use in their
  107.   MM3000 Product.  This format is only available for X6 data-type.
  108.  
  109.   AAMMDD  is  similar  to  YYMMDD,  but  the  year  portion of the date uses a
  110.   combination of letters and numbers of the alphabet to represent years beyond
  111.   1999.
  112.  
  113.   By  substituting a letter in the alphabet in the first position of the year,
  114.   we can extend a six-digit date  and  also  insure  that  the  dates  collate
  115.   correctly.  For example:
  116.  
  117.     YY of AAMMDD         CCYY
  118.     A0 - A9              2000 - 2009
  119.     B0 - B9              2010 - 2019
  120.     C0 - C9              2020 - 2029
  121.  
  122.   Since  letters  are  greater  than  numbers in the collating sequence we can
  123.   insure that AAMMDD dates beyond 1999 will order correctly.
  124.  
  125.  
  126. Invalid Dates
  127.  
  128.   The If command now has a $Invalid function to find all invalid dates  for  a
  129.   particular field.  An invalid date is any number of a particular date format
  130.   whose date equivalent cannot be found on the calendar.  For example  a  date
  131.   with a month of 99, will be considered invalid.
  132.  
  133.      >base store.demo
  134.      Database password [;]?
  135.      >get d-sales
  136.      >item deliv-date,date,ccyymmdd
  137.      >if $invalid(deliv-date)
  138.      >out baddates,link
  139.      >xeq
  140.  
  141.  
  142. Converting Dates
  143.  
  144.   Suprtool  is  capable of converting dates from one format to another using a
  145.   variety of Suprtool features.  We will show how Suprtool can convert  common
  146.   dates  without  the  century to those that have the century included.  While
  147.   Suprtool can convert your data, it is up to you  to  change  your  programs.
  148.   Adager  a third-party program for changing Image database structures has the
  149.   ability  to  change  date  fields.   Suprtool  can  convert  data  in  Image
  150.   databases, flat files, self-describing files and KSAM files.
  151.  
  152.  
  153. Case #1 - Converting a J2 date from YYMMDD to CCYYMMDD.
  154.  
  155.   Since  Suprtool  can do arithmetic expressions we can alter a date to put 19
  156.   in front of it.  But what if all the dates are not actually dates but rather
  157.   filled with 9's as some sort of flag to your application.
  158.  
  159.   We  have  a  dataset  with  two date fields, J2 items and in the date format
  160.   YYMMDD.
  161.  
  162.   Database: STORE.DB.GREEN
  163.  
  164.       D-SALES          Detail    Set 5
  165.          Entry:                     Offset
  166.             CUST-ACCOUNT         Z8      1  (!M-CUSTOMER)
  167.             DELIV-DATE           J2      9
  168.             PRODUCT-NO           Z8     13  (M-PRODUCT)
  169.             PRODUCT-PRICE        J2     21
  170.             PURCH-DATE           J2     25
  171.             SALES-QTY            J1     29
  172.             SALES-TAX            J2     31
  173.             SALES-TOTAL          J2     35
  174.       Capacity: 602 (14)  Entries: 10  Highwater: 10  Bytes: 38
  175.  
  176.   First we need to know and understand our data.  Are their invalid dates?  If
  177.   so, does the value have some other logical meaning.
  178.  
  179.     >get d-sales
  180.     >item deliv-date,date,yymmdd
  181.     >item purch-date,date,yymmdd
  182.     >if $invalid(deliv-date) or $invalid(purch-date)
  183.     >list
  184.     >xeq
  185.     >GET D-SALES (9) >OUT $NULL (0)
  186.     CUST-ACCOUNT    = 10010          DELIV-DATE      = 999999
  187.     PRODUCT-NO      = 50513001       PRODUCT-PRICE   = 19220
  188.     PURCH-DATE      = 999999         SALES-QTY       = 2
  189.     SALES-TAX       = 2691           SALES-TOTAL     = 21910
  190.  
  191.     >GET D-SALES (10) >OUT $NULL (1)
  192.     CUST-ACCOUNT    = 10010          DELIV-DATE      = 125213
  193.     PRODUCT-NO      = 50513001       PRODUCT-PRICE   = 19220
  194.     PURCH-DATE      = 1              SALES-QTY       = 2691
  195.     SALES-TAX       = 21910          SALES-TOTAL     = 21910
  196.  
  197.     IN=10, OUT=2.  CPU-Sec=1.  Wall-Sec=1.
  198.  
  199.   We  see  two  records  that  do  not  contain proper dates, the first record
  200.   contains all 9's, which is probably used as some sort of flag.  You may need
  201.   to add an additional leading "99" to these dates.
  202.  
  203.   But the second record is obviously wrong.  Use DBEdit to correct this record
  204.   and continue on to convert the other dates.  Knowing your data is  necessary
  205.   in order to properly convert to a new date format.
  206.  
  207.   After  fixing  up the dates that are incorrect we can now get ready to start
  208.   converting the dates.
  209.  
  210.   You can convert prefix 19 in front of all of the appropriate dates by  using
  211.   the  following  extract  statement.   Please  note that we are updating this
  212.   directly.  So that we can redo this task if it is stopped halfway,  we  only
  213.   convert those dates that have not yet been converted.
  214.  
  215.        >get d-sales
  216.        >item purch-date,date,yymmdd
  217.        >if not $invalid(purch-date) and purch-date < 999999
  218.        >update
  219.        >ext purch-date = purch-date + 19000000
  220.        >xeq
  221.  
  222.   If  you  have  records  containing years between 00 and 10 and they actually
  223.   represent 2000 and 2010, you should change the If command to update them  in
  224.   a separate pass.  The first pass updates all 20th century dates;
  225.  
  226.        >get d-sales
  227.        >item purch-date,date,yymmdd
  228.        >if not $invalid(purch-date) and purch-date / 10000 > 10
  229.        >update
  230.        >ext purch-date = purch-date + 19000000
  231.        >xeq
  232.  
  233.   Second pass for those dates in the 21-st century:
  234.  
  235.        >get d-sales
  236.        >item purch-date,date,yymmdd
  237.        >if not $invalid(purch-date) and purch-date / 10000 <= 10
  238.        >update
  239.        >ext purch-date = purch-date + 20000000
  240.        >xeq
  241.  
  242.   We  now  have converted all the J2 YYMMDD dates to CCYYMMDD format and added
  243.   the correct century to the date.
  244.  
  245.  
  246. Case #2 X6 YYMMDD data to X8 CCYYMMDD
  247.  
  248.   The following Suprtool task shows how we can generate a new file to put into
  249.   a new database with dates in a different format.
  250.  
  251.   Consider the Deliv-date and purch-date fields of the D-Sales dataset:
  252.  
  253.   Database: STORE.DBOLD.ACCOUNT
  254.  
  255.       D-SALES          Detail    Set 5
  256.          Entry:                     Offset
  257.             CUST-ACCOUNT         Z8      1  (!M-CUSTOMER)
  258.             DELIV-DATE           X6      9
  259.             PRODUCT-NO           Z8     15  (M-PRODUCT)
  260.             PRODUCT-PRICE        J2     23
  261.             PURCH-DATE           X6     27
  262.             SALES-QTY            J1     33
  263.             SALES-TAX            J2     35
  264.             SALES-TOTAL          J2     39
  265.       Capacity: 611 (13)  Entries: 15  Highwater: 15  Bytes: 42
  266.  
  267.   We  want  to convert to a date format with room for a CC at the beginning of
  268.   the deliv-date and purch-date:
  269.  
  270.  
  271.      Database: STORE.DB.ACCOUNT
  272.  
  273.       D-SALES          Detail    Set 5
  274.          Entry:                     Offset
  275.             CUST-ACCOUNT         Z8      1  (!M-CUSTOMER)
  276.             DELIV-DATE           X8      9
  277.             PRODUCT-NO           Z8     17  (M-PRODUCT)
  278.             PRODUCT-PRICE        J2     25
  279.             PURCH-DATE           X8     29
  280.             SALES-QTY            J1     37
  281.             SALES-TAX            J2     39
  282.             SALES-TOTAL          J2     43
  283.       Capacity: 608 (16)  Entries: 0  Highwater: 0  Bytes: 46
  284.  
  285.   In order to convert these dates we need to be able to put either a 19 or  20
  286.   in  front of the YYMMDD date, depending on the value of the year.  Before we
  287.   can do either of these we must confirm, once again that we have  no  invalid
  288.   dates.
  289.  
  290.     >base store.dbold
  291.     >get d-sales
  292.     >item deliv-date,date,yymmdd
  293.     >item purch-date,date,yymmdd
  294.     >if $invalid(deliv-date) or $invalid(purch-date)
  295.     >list
  296.     >xeq
  297.  
  298.   Once  we  have  confirmed  that  there  are  no  invalid  dates we can start
  299.   converting the dates that we have.  Since there are two date fields in  this
  300.   dateset  we  must  be  careful to add the appropriate Century for the proper
  301.   field.  For this example we assume that if a year is less that 1950 then the
  302.   century should be 20.
  303.  
  304.   We can easily convert each date by processing each field separately by using
  305.   an intermediate self-describing file:
  306.  
  307.      >base store.dbold,1
  308.      Database password [;]?
  309.  
  310.      >get d-sales
  311.      >set squeeze off
  312.      >item deliv-date,date,yymmdd
  313.      >if deliv-date >= $date(1950/01/01)
  314.      >out sales01,link
  315.      >ext cust-account
  316.      >ext "19"
  317.      >ext deliv-date / sales-total
  318.      >xeq
  319.      IN=15, OUT=14.  CPU-Sec=1.  Wall-Sec=5.
  320.  
  321.   Now insert 20 to the century for the appropriate records:
  322.  
  323.      >base store.dbold
  324.      >get d-sales
  325.      >if deliv-date < $date(1950/01/01)
  326.      >ext cust-account
  327.      >ext "20"
  328.      >ext deliv-date / sales-total
  329.      >out sales01,link,append
  330.      >xeq
  331.  
  332.   Now we can convert the other field from the flat file, (sales01) and  add  a
  333.   century to the purch-date field:
  334.  
  335.      >reset
  336.      >base                 {close the open database}
  337.      >in sales01
  338.      >item purch-date,date,yymmdd
  339.      >if purch-date >= $date(1950/01/01)
  340.      >set squeeze off
  341.      >out sales02,link
  342.      >ext cust-account / product-price
  343.      >ext "19"
  344.      >ext purch-date / sales-total
  345.      >xeq
  346.      IN=15, OUT=15.  CPU-Sec=1.  Wall-Sec=1.
  347.  
  348.   Since  we  extracted  all 15 records we know we do not have any records with
  349.   the purch-date field that need to be updated with a "20".
  350.  
  351.   Now we can insert the records into the new database:
  352.  
  353.      >base store.db
  354.      >in sales02
  355.      >put d-sales
  356.      >xeq
  357.  
  358.   Now we have converted two dates from X6 format to an X8 format.
  359.  
  360.  
  361.  
  362. Case #3 Different date formats X6 MMDDYY data to X6 YYMMDD
  363.  
  364.   The following Suprtool task shows how we convert a date in a self-describing
  365.   file from MMDDYY to YYMMDD format.
  366.  
  367.   Consider   the  following  self-describing  file  with  the  deliv-date  and
  368.   purch-date fields:
  369.  
  370.  
  371.        File: SALES04.DATA.ACCOUNT   (SD Version B.00.00)
  372.           Entry:                     Offset
  373.              CUST-ACCOUNT         Z8      1
  374.              DELIV-DATE           X6      9       <<MMDDYY>>
  375.              PRODUCT-NO           Z8     15
  376.              PRODUCT-PRICE        I2     23
  377.              PURCH-DATE           X6     27       <<MMDDYY>>
  378.              SALES-QTY            I1     33
  379.              SALES-TAX            I2     35
  380.              SALES-TOTAL          I2     39
  381.        Limit: 115  EOF: 15  Entry Length: 42  Blocking: 97
  382.  
  383.   We want to convert these two dates to a data  format  of  YYMMDD,  prior  to
  384.   converting  adding  a  century  in  front  of  the year.  This can be easily
  385.   accomplished by defining each sub part of the date and  extracting  them  in
  386.   the new order.
  387.  
  388.  
  389.      >in sales04
  390.      >def deliv-date-mm,deliv-date[1],2
  391.      >def deliv-date-dd,deliv-date[3],2
  392.      >def deliv-date-yy,deliv-date[5],2
  393.      >def purch-date-mm,purch-date[1],2
  394.      >def purch-date-dd,purch-date[3],2
  395.      >def purch-date-yy,purch-date[5],2
  396.      >ext cust-account
  397.      >ext deliv-date-yy
  398.      >ext deliv-date-mm
  399.      >ext deliv-date-dd
  400.      >ext product-no / product-price
  401.      >ext purch-date-yy
  402.      >ext purch-date-mm
  403.      >ext purch-date-dd
  404.      >ext sales-qty / sales-total
  405.      >out sales05,link
  406.      >xeq
  407.  
  408.   We  now  have  a file with the dates in YYMMDD order but the self-describing
  409.   information shows three separate fields.
  410.  
  411.       File: SALES05.DATE.ACCOUNT     (SD Version B.00.00)
  412.          Entry:                     Offset
  413.             CUST-ACCOUNT         Z8      1
  414.             DELIV-DATE-YY        X2      9
  415.             DELIV-DATE-MM        X2     11
  416.             DELIV-DATE-DD        X2     13
  417.             PRODUCT-NO           Z8     15
  418.             PRODUCT-PRICE        I2     23
  419.             PURCH-DATE-YY        X2     27
  420.             PURCH-DATE-MM        X2     29
  421.             PURCH-DATE-DD        X2     31
  422.             SALES-QTY            I1     33
  423.             SALES-TAX            I2     35
  424.             SALES-TOTAL          I2     39
  425.       Limit: 115  EOF: 15  Entry Length: 42  Blocking: 97
  426.  
  427.   We can convert these several fields to one field with another extract task:
  428.  
  429.       >in sales05
  430.       >def deliv-date,9,6,byte
  431.       >def purch-date,27,6,byte
  432.       >item deliv-date,date,yymmdd
  433.       >item purch-date,date,yymmdd
  434.       >ext cust-account
  435.       >ext deliv-date
  436.       >ext product-no
  437.       >ext product-price
  438.       >ext purch-date
  439.       >ext sales-qty / sales-total
  440.       >out sales06,link
  441.       >xeq
  442.       IN=15, OUT=15.  CPU-Sec=1.  Wall-Sec=1.
  443.  
  444.   We now end up with a file that looks like this:
  445.  
  446.       File: SALES06.DATA.ACCOUNT   (SD Version B.00.00)
  447.          Entry:                     Offset
  448.              CUST-ACCOUNT         Z8      1
  449.              DELIV-DATE           X6      9       <<YYMMDD>>
  450.              PRODUCT-NO           Z8     15
  451.              PRODUCT-PRICE        I2     23
  452.              PURCH-DATE           X6     27       <<YYMMDD>>
  453.              SALES-QTY            I1     33
  454.              SALES-TAX            I2     35
  455.              SALES-TOTAL          I2     39
  456.        Limit: 115  EOF: 15  Entry Length: 42  Blocking: 97
  457.  
  458.   You then add the century to these fields as described above.
  459.  
  460.  
  461. ========================================================================
  462.