× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello,

I am working with a query tool and am having trouble formatting a field as a
date in a SQL Select statement. Here's what is going on. I have two files
from the iSeries. One has a date field that is defined as numeric 6.0 and
in YYMMDD format. The following code will output the date as MM/DD/YYYY

DATE(SUBSTR(DIGITS(OHETDT),3,2) CONCAT '/' CONCAT
SUBSTR(DIGITS(OHETDT),5,2) CONCAT '/' CONCAT
SUBSTR(DIGITS(OHETDT),1,2)) AS ENTRY_DATE



Another file I am working with has a date field that is defined as variable
V50 as bbYYYYMMDD. The following code gives me blank output.

DATE(SUBSTR(DIGITS(SHIP_DATE),7,2) CONCAT '/' CONCAT
SUBSTR(DIGITS(SHIP_DATE),9,2) CONCAT '/' CONCAT
SUBSTR(DIGITS(SHIP_DATE),5,2)) AS DATE_SHIPPED


I believe I have the positions line up properly as the date doesn't actually
start until position 3 in the field. Are variable length fields handled
differently in SQL for what I am trying to do?






Fred Horvat
horvat@xxxxxxxx
216-426-5692





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.