On of the cool things about the iSeries is that a data file that is written to my a legacy RPG program can be munipultated using SQL. From a client like JDBC or some DB2 client those file look just like a table. This is why the legacy applications did not store the date in a TIMESTAMP column. below is the function.
CREATE FUNCTION COMMON.TIMESTAMP_FROM_YFU (
YFUDATE NUMERIC(8, 0) ,
YFUTIME NUMERIC(4, 0) )
RETURNS TIMESTAMP
LANGUAGE SQL
SPECIFIC COMMON.TIMESTAMP_FROM_YFU
DETERMINISTIC
CONTAINS SQL
RETURNS NULL ON NULL INPUT
NO EXTERNAL ACTION
SET OPTION ALWBLK = *ALLREAD ,
ALWCPYDTA = *OPTIMIZE ,
COMMIT = *NONE ,
DECRESULT = (31, 31, 00) ,
DFTRDBCOL = *NONE ,
DYNDFTCOL = *NO ,
DYNUSRPRF = *USER ,
SRTSEQ = *HEX
RETURN TIMESTAMP_FORMAT ( VARCHAR ( YFUDATE ) || DIGITS ( YFUTIME ) , 'YYYYMMDDHH24MI' ) ;
COMMENT ON SPECIFIC FUNCTION COMMON.TIMESTAMP_FROM_YFU
IS 'Timestamp from YFU Date and time' ;
No comments:
Post a Comment