Thanks Dennis - I have done this and the values are correct in the DS fields. The problem occurs when the eval of the DS decimal fields back into the return variables of the function. It always occurs on the first defined decimal field Most annoying.
________________________________
From: rpg400-l-bounces@xxxxxxxxxxxx on behalf of Dennis Lovelady
Sent: Sun 4/18/2010 03:00 AM
To: 'RPG programming on the IBM i / System i'
Subject: RE: UDTF - Decimal data error
WHAT IS WRONG WITH THE DECIMAL PACKED FIELDS THAT THEY CANNOT BE
HANDLED BY THE USER DEFINED FUNCTION???oR IS SOMETHING ELSE CAUSING THE
PROBLEM. IF i TAKE OUT THE PACKED FIELDS ALL WORKS FINE.
when CALLTYPE = CALL_FETCH;
EXEC SQL FETCH next FROM Cmscm03CSR INTO
:c3;
eval C3IDSEQO = d3IDSEQ ;
eval C3BRNCDEO = d3BRNCDE ;
eval C3INCDATEO =%CHAR(d3INCDATE) ;
eval C3COLDATEO =%CHAR(d3COLDATE) ;
eval C3PRO1O = d3PRO1 ;
eval C3PRO2O = d3PRO2 ;
eval C3NAMEO = d3NAME ;
eval C3IDREGNUO = d3IDREGNUM ;
eval C3POLREFO = d3POLREF ;
eval C3EMPNOO = d3EMPNO ;
My money's on a mismatch between the columns named in the SELECT known as
Cmscm03CSR and the C3 data structure.
Please add OPTION(*SRCSTMT) to the header specs of the program (if not there
already) and recompile. Then, when the failure occurs, take a look at the
line number of the failure (found by pressing F9 when your detailed message
is displayed). Take a look at that line number in the RPG; this will help
you identify the troublesome field. Hopefully that will lead to your own
answer. If not, please post back with more detail and information gained in
this step.
Also, ensure that SQLCOD is zero at the failure point. Maybe some warning
message is being overlooked.
Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"They couldn't hit an elephant at this dist---"
-- last words of Union army commander John Sedwick as he addressed
his troops during a (US) Civil War battle
--
This is the RPG programming on the IBM i / System i (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.
The information contained in this email is confidential and may contain proprietary information. It is meant solely for the intended recipient. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted in reliance on this, is prohibited and may be unlawful. No liability or responsibility is accepted if information or data is, for whatever reason corrupted or does not reach its intended recipient. No warranty is given that this email is free of viruses. The views expressed in this email are, unless otherwise stated, those of the author and not those of HYPHEN Technology (Pty) Ltd or its management. HYPHEN Technology (Pty) Ltd reserves the right to monitor, intercept and block emails addressed to its users or take any other action in accordance with its email use policy.
As an Amazon Associate we earn from qualifying purchases.