Hi Esben
You can try using UDF iDate for converting the A2DATE into a DATE field
ALV . RSTDTE = iDate(A2ATE)
iDate can be found at Think400.dk download section, works great and fast.
Brgds
Helge
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Esben Kiel Sørensen
Sent: Wednesday, May 07, 2008 7:39 AM
To: RPG programming on the AS400 / iSeries
Subject: Join two files with different time format
Hi all,
I'm trying to join two files, but the problem is that the files don't have
the same date format. One is an 8 digits decimal date, and the other is a
"real" data field '2008-04-25'.. How can i join these?
I tried:
DECLARE A CURSOR FOR
SELECT 'D' , ALV . EMPNUM , ALV . LVCDE , ( YEAR ( ALV . RSTDTE ) * 10000 )
+ ( MONTH ( ALV . RSTDTE ) * 100 ) + ( DAY ( ALV . RSTDTE ) ) , ALV . RSTTME
, ALV . LVEDUR , SCD . A2SSHIFT , ALV . SDTALV + 19000000 , : H , : H , ' '
, : H , : H
FROM STPALV ALV , ATS002P SCD
WHERE ALV . EMPNUM = SCD . A2EMPNO AND
ALV . LOCN = SCD . A2LOCN
AND LVESTS = '5' AND
ALV . RSTDTE = DATE ( INSERT ( INSERT ( DIGITS ( A2DATE ) , 5 , 0 , '-' )
, 8 , 0 , '-' ) )
AND ALV . EMPNUM < 80000 AND NOT EXISTS ( SELECT * FROM ATS006P WHERE ALV
. LVCDE = A6LVCDE )
AND ALV . LVCDE NOT IN ( 'UNXAG' , 'TUNAX' , 'TUNXA' ) FOR READ ONLY
RSTDTE is the field defined like 10 L and A2DATE is a 8.0 decimal.
This works, but is take like for ever to prepare this cursor... Any
suggestions, on how to make this perform better?
Yours sincerely / Med venlig hilsen
Esben Kiel Sørensen
Software Developer
E-mail: eksor@xxxxxxxxxx
--
This is the RPG programming on the AS400 / 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.