Download PDF 6.9M - Robelle

Transcript
>get d-sales
>set date cutoff 30
>item purch-date,date,yymmdd
>item deliv-date,date,yymmdd
>if not $invalid(purch-date) and not $invalid(deliv-date)
>update
>ext purch-date = $stddate(purch-date)
>ext deliv-date = $stddate(deliv-date)
>xeq
We have now converted all the J2 yymmdd dates to a ccyymmdd format and added
the correct century to the date.
Case 2: X6 yymmdd Data to X8 ccyymmdd
The following Suprtool task shows how you can generate a new file to put into a new
database with dates in a different format.
Consider the deliv-date and purch-date fields of the D-Sales dataset:
Database: STORE.DBOLD.ACCOUNT
D-SALES
Detail
Set 5
Entry:
Offset
CUST-ACCOUNT
Z8
1 (!M-CUSTOMER)
DELIV-DATE
X6
9
PRODUCT-NO
Z8
15 (M-PRODUCT)
PRODUCT-PRICE
J2
23
PURCH-DATE
X6
27
SALES-QTY
J1
33
SALES-TAX
J2
35
SALES-TOTAL
J2
39
Capacity: 611 (13) Entries: 15 Highwater: 15 Bytes: 42
You want to convert to a date format with room for a cc at the beginning of the
deliv-date and purch-date:
Database: STORE.DB.ACCOUNT
D-SALES
Detail
Set 5
Entry:
Offset
CUST-ACCOUNT
Z8
1 (!M-CUSTOMER)
DELIV-DATE
X8
9
PRODUCT-NO
Z8
17 (M-PRODUCT)
PRODUCT-PRICE
J2
25
PURCH-DATE
X8
29
SALES-QTY
J1
37
SALES-TAX
J2
39
SALES-TOTAL
J2
43
Capacity: 608 (16) Entries: 0 Highwater: 0 Bytes: 46
In order to convert these dates you need to be able to put either a 19 or 20 in front of
the yymmdd date, depending on the value of the year. Before you can do either of
these you must confirm, once again, that you have no invalid dates.
>base store.dbold
>get d-sales
>item deliv-date,date,yymmdd
>item purch-date,date,yymmdd
>if $invalid(deliv-date) or $invalid(purch-date)
>list
>xeq
Once you have confirmed that there are no invalid dates you can start converting the
dates that you have. Because there are two date fields in this dataset you must be
careful to add the appropriate century for the proper field. For this example, assume
that if a year is less than 1950 then the century should be 20.
Suprtool 4.6 for HP e3000
Suprtool Issues and Solutions • 87