Solved

Zoned data type

Posted on 2006-10-23
2
494 Views
Last Modified: 2012-08-13
I using the Iseries query to extract data from an AS400 and need to be able to covert the Zoned data type to date format.

Any thoughts?

0
Comment
Question by:franco2
2 Comments
 
LVL 37

Assisted Solution

by:momi_sabag
momi_sabag earned 50 total points
ID: 17798490
hi

in order to that you need to know how the date format is represent
where do you get the data from ?

a zoned format is as follow :
first byte - FAC for +,  BDE for - (sign byte) - usually c and d will be used
after that from left to right, each byte represents a digit,

so for example the value for +80 is
C0 80

the value for -111 is
D111


and so on

momi sabag
0
 
LVL 18

Accepted Solution

by:
daveslash earned 150 total points
ID: 17805100

You'll need to know the format that the date is stored in. (e.g. YYYYMMDD or YYMMDD or MMDDYY etc..)

For a zoned numeric date stored as YYYYMMDD, the following works for me:

select
  date(
  left(char(zonedDate),4) || '-' ||    
  substr(char(zonedDate),5,2) || '-' ||
  substr(char(zonedDate),7,2))        
from MyTable

DATE      
1966-03-21

HTH,
DaveSlash
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now