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



Doug,

Recently Joe Pluta wrote a post here with the concept of
using either a view or a DDS LF that did not include the PF
date and time fields. If this LF was used for adding
records, the current time and date would go into the PF.


Regards,

Luis
--- @midrange.com wrote:


------------------------------

message: 5
date: Thu, 22 May 2008 14:04:42 -0500
from: Doug Palme <D>
subject: Re: Question on SQL Table (DDL) with date and
time fields

Rob,
I just spent four hours chasing that down :) and I will
be slowly getting
rid of the writes and changing it out with the
insert......but I am
probably going to upset a few more people in doing so
LOL......


From:
r
To:
RPG programming on the AS400 / iSeries
<>
Date:
05/22/2008 01:59 PM
Subject:
Re: Question on SQL Table (DDL) with date and time fields



The problem is that UPDATE, in rpgle, supports %fields.
However WRITE
does not. Therefore you have to write out the whole
buffer. And, if you
never initialized those fields it will write out low
values.
Dump WRITE, adopt SQL's INSERT instead.
I suppose you could create a DCR that WRITE support
%fields.

https://www-912.ibm.com/r_dir/ReqDesChange.nsf/Request_for_Design_Change?OpenForm


Another option is:
phdate=%date();
phtime=%time();
write record;

Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
Dock 108
6928N 400E
Kendallville, IN 46755






Doug Palme <DP>
Sent by: r@xxxxxxxxxxxx
05/22/2008 12:40 PM
Please respond to
RPG programming on the AS400 / iSeries
<>


To
RPG programming on the AS400 / iSeries
<@midrange.com>
cc

Subject
Re: Question on SQL Table (DDL) with date and time fields






Here is what I added to the DDL:

0002.00 PHDATE DATE WITH DEFAULT CURRENT DATE,
0003.00 PHTIME TIME WITH DEFAULT CURRENT TIME,
....

When using DBU it works perfectly....however, when a
program writes a
record those fields end up with a default date of
00001-01-01 and a
default time of 00.00.00......obviously I am doing
something wrong.....





From:
R Bruce Hoffman <@>
To:
RPG programming on the AS400 / iSeries
<@>
Date:
05/22/2008 10:07 AM
Subject:
Re: Question on SQL Table (DDL) with date and time fields



create table ... ( .... date with default current date
... )

Only defaults on insert when the field is not specified
in the insert
list. Updates leave it unaffected.

Doug Palme wrote:
is there a way to auto populate a date / time field
with the current
date
and time without actually having code to do it? IE: Is
there a default
setting within the DDL spec that would cause the date
field to be
filled?

Although as I think about this, that might be a problem
on subsequent
updates......




Luis Rodriguez

IBM Certified Systems Expert
eServer i5 iSeries Technical Solutions




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.