Solved

Zoned data type

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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…

776 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