Solved

Zoned data type

Posted on 2006-10-23
2
501 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Creating and Managing Databases with phpMyAdmin in cPanel.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
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…

679 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