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



This doesn't exactly answer your question but...
One answer you already alluded to...write to the file with SQL.

CREATE TABLE MIKETEST/MAKTESTDJ (FIELD1 DEC (5 , 0) NOT NULL WITH
DEFAULT, ALPHA1 CHAR (10 ) NOT NULL WITH DEFAULT, DATE1 DATE NOT
NULL WITH DEFAULT, TIME1 TIME NOT NULL WITH DEFAULT);            


INSERT INTO MIKETEST/MAKTESTDJ (FIELD1, ALPHA1) VALUES(1, 'A');
INSERT INTO MIKETEST/MAKTESTDJ (FIELD1, ALPHA1) VALUES(55, 'SPEED');


FIELD1   ALPHA1      DATE1       TIME1    
     1   A           2012-06-25  16:00:42 
    55   SPEED       2012-06-25  16:00:55
 

Using the DDS below, gave similar results when doing inserts.
A          R MAKTESTDJ                             
A            FIELD1         5  0                   
A            ALPHA1        10                      
A            DATE1           L                     
A                                      DATFMT(*ISO)
A            TIME1           T                     
A                                      TIMFMT(*ISO) 

Leads me to believe it is an RPG thing. Wrote this test program:

FMAKTESTDJ o    e             disk    rename(maktestdj:djRcd)
c                   eval      field1 = 2                    
c                   eval      alpha1 = 'DOS'                
c                   write     djRCD                         
c                   eval      field1 = 100                  
c                   eval      alpha1 = 'Fast'               
c                   write     djRCD                         
c                   eval      *inlr = *on                   


FIELD1   ALPHA1      DATE1       TIME1   
    55   SPEED       2012-06-25  16.05.21
     1   A           2012-06-25  16.05.26
     2   DOS         0001-01-01  00.00.00
   100   Fast        0001-01-01  00.00.00


Yep, RPG thing. I suspect that RPG has to initialize those fields and thus you don't get the default.




________________________________
From: dale janus <dalejanus@xxxxxxxxxxxxxxxxx>
To: rpg400-l@xxxxxxxxxxxx
Sent: Monday, June 25, 2012 3:48 PM
Subject: When is date field (L) updated?

I have a file defined with DDS (it's a long slow process moving to DDL). 
It has a date field defined as type L. The default value is current date,
I confirmed it as  shown in OPS NAV.

What I want DB2 to do is put in  today's date whenever I add a record. 
What I get is 0001-01-01.

This is the kind of thing I would like to let DB2 handle.  Do I need to
make it a timestamp field for that to work?  Or change the definition
with OPS NAV to something else?

I guess I  can always update with current date in RPG, but I'm trying to
use some of these new shiny tools that are available.


---Dale





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.