× 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.



A minor nit-pick, but try using the SQL hex() function with a date field
and you just might get to see the internal format. And of course using MI
you can surface the internal 4-byte date values, 3-byte time values, and
10-byte timestamp values (several MI date/time/timestamp instructions are
documented in the Knowledge Center).


On Wed, Jul 9, 2014 at 2:32 PM, Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:

"For instance, as I understand it, a date field is only 4 somethings in
length."

I was simply trying to point out that it is only on disk that dates are 4
bytes long. By the time they have been "surfaced" by the OS they are an 8
or 10 byte character field and can (through redefinition) be manipulated as
such. Not relevant to the OP's ? - but I wanted to clarify for the record.


On 2014-07-09, at 1:47 PM, Booth Martin <booth@xxxxxxxxxxxx> wrote:

Dang. Another learning opportunity for me. Best not to waste it.

OK. I admit to total confusion. I do not see the difference between
what you wrote and what I wrote. I am betting that what I am not seeing is
significant. :)


On 7/9/2014 12:25 PM, Jon Paris wrote:
No Booth - that is only on the database - we can never see them that
way though - they are surfaced to the program as character fields.


On 2014-07-09, at 1:15 PM, Booth Martin <booth@xxxxxxxxxxxx> wrote:

D, T, and Z fields are not stored in any format useful to us. For
instance, as I understand it, a date field is only 4 somethings in length.
These fields know what they are and we don't care what they are. We only
care how we see them. In other words, QTSTAMP is not a z field so you
can't slip a z field in to it. If QTSTAMP is a new field in the file, why
not change the field's definition to being a timestamp field?


On 7/9/2014 11:40 AM, Dale Janus wrote:
I have an old file that contains a date in yyyymmdd and time in
hhmmss as decimals. I am trying to create a time stamp field from them.

d newdate s D inz(d'2012-10-10')
d newtime s T inz(t'23.30.59')
D myts s z

c eval newdate = %date(gqtdten:*iso)
c eval newtime = %time(gqttime:*hms)
c eval myts = newdate + newtime
c
c eval qtstamp = myts




My debug calcs looks like I created the time stamp correctly, but
when I go to write the record, I get CPF5035, Data mapping error on member
QUOTEHIST code 17, bad date, time, timestamp.
I dumped the program and the field looks like this:

QTSTAMP TIMESTAMP(26) '2013-11-25-07.58.12.000000'
VALUE IN HEX
'F2F0F1F360F1F160F2F560F0F74BF5F84BF1F24BF0F0F0F0F0F0'X
QTSTAT CHAR(2) 'OH' 'D6C8'X
QTTIME PACKED(6,0) 075812. '0075812F'X




I can step through the program with debug, but when I go to write, I
get the error on the first record

C WRITE QThREC



I thought I was doing good moving this stuff around and creating a
new time stamp. it looks good to me. but something is wrong.

There is only one timestamp field, all other fields are character or
decimal. The only other field is a record id. The new file is defined by
DDL and contains a unique record id that I am assuming the system will
generate.

---Dale


--
Booth Martin
www.martinvt.com
(802)461-5349
Skype: booth.martin

Living on Earth may be expensive, but it includes an annual free trip
around the Sun.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Jon Paris

www.partner400.com
www.SystemiDeveloper.com





--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com




--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.