Solved

Zoned data type

Posted on 2006-10-23
2
503 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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:
Dave Ford 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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
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…

731 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