Solved

Zoned data type

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
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…

757 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

23 Experts available now in Live!

Get 1:1 Help Now