• Subject: RE: Y2K Question: Sorting files when usi
  • From: Joe Teff <jteff19@xxxxxxx>
  • Date: Mon, 20 Jul 1998 21:44:52 -0500

I realize that any solution other than enlarging the date field or using a date 
data
type is not a good thing. On the other hand, if you have not made your systems
Y2K compliant by now, you are already in trouble. Using alternate collating 
sequence
will allow you to sort your files correctly with a 6-digit date or 2-digit 
year, but it
still leaves you unable to select a group of records based on a date. Using a 
translate
table will allow you to build a century field into your logical.

First you would create a translation table to convert 0 thru 3 to a 1 and 4 
thru 9 to a 0
(this will provide windowing for 1940 thru 2039). We will call this table 
DECADE_TBL.

Next we will change our logical to create a field based on a translated year.

     A                 R   ORDDETR                                   
PFILE(ORDDET)
     A                       ODITNR
     A                       ODDTSP
     A                       ODORDN
     A                       ODACTV
     A                       ODCENT                         1    I     
SST(ODDTSP 1 1)
     A                                                                          
 TRNTBL(DECADE_TBL)
     A                  K   ODITNR
     A                  K   ODCENT
     A                  K   ODDTSP

ODITNR (Item #), ODDTSP (Date Shipped), ODORDN (Order #) and ODACTV
(Active Status) are fields from the physical file. ODCENT (Century Flag) is
created in this logical. The Date Shipped is a 6-digit, zoned decimal field. You
can use this with packed fields as well, but you must convert the field to an
intermidiate zoned field in the logical first.

Joe Teff
Information Technology Consultant
IBM Certified Specialist - AS/400 RPG Programmer
Quality Data Systems
Minneapolis, MN

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].