Search code examples
db2ibm-midrange

Date display format difference in STRSQL


I've been wondering how fields with DECIMAL data type gets displayed in a date format when queried in STRSQL.

For instance, there are two fields, create date and change date in a table defined as decimal (7). But when you query this field through STRSQL, it gets displayed as

....+....1....+....2 
    Change     Create 
    Date       Date   
 117/06/16   95/05/27 

How is this possible? I mean where does the Slashes come from? I think this was defined as a PF pretty long back and the DDS is not available.


Solution

  • I was able do duplicate your scenario using the EDTWRD keyword in this test DDS (DATE2 was a legit 'L' type date field for reference only).

        A          R TESTR                                         
        A            DATE1          7S 0       EDTWRD('   /  /  ')
        A            DATE2           L         DATFMT(*YMD)        
        A            DATE3          7S 0       EDTWRD('   /  /  ') 
    

    Then used DFU to enter your values in DATE1 and DATE3, which yielded this in a query:

        Line    ....+....1....+....2....+....3       
                    DATE1  DATE2         DATE3       
        000001  117/06/16  17-07-18   95/05/27