×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Hi Rob,

Try Substringing all but the last byte, and checking that for
'404040...'

Martin
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx
Sent: 17 May 2007 19:26
To: RPG programming on the AS400 / iSeries
Subject: Re: SQL, fetch & decimal data error

In the following program, the value of MYNBR, when in debug is
-4040404040.40407

and the dds is
R KIRKR
MYKEY 5A
MYNBR 15P 5

So I am not getting the error you report.

H ActGrp(*CALLER)
H DftActGrp(*NO)

D OpenCursor PR n
D FetchCursor PR n
D CloseCursor PR n

D MyLib s 10a
D MyFile s 10a

d extds e ds extname(kirk)
/free
*inlr=*on;
if not OpenCursor();
// perform error routine to alert the troops
// ...
Else;
Dow FetchCursor();
// putting the fetchcursor on the do loop allows the user of
// iter, and thus iter will not perform an infinite loop
// normal processing here...
EndDo;
CloseCursor();
EndIf;
return;
/end-free

P OpenCursor B
D OpenCursor PI like(ReturnVar)
D ReturnVar s n

C/EXEC SQL
C+ Set Option
C+ Naming = *Sys,
C+ Commit = *None,
C+ UsrPrf = *User,
C+ DynUsrPrf = *User,
C+ Datfmt = *iso,
C+ CloSqlCsr = *EndMod
C/END-EXEC

C/EXEC SQL
C+ Declare C1 cursor for
C+ Select *
C+ from kirk
C/END-EXEC

C/EXEC SQL
C+ Open C1
C/END-EXEC

/free
Select;
When SqlStt='00000';
return *on;
Other;
return *off;
EndSl;
/end-free
P OpenCursor E

/eject
P FetchCursor B
D FetchCursor PI like(ReturnVar)
D ReturnVar s n
C/EXEC SQL
C+ Fetch C1 into :extds
C/END-EXEC
/free
Select;
When sqlstt='00000';
// row was received, normal
ReturnVar=*on;
When sqlstt='02000';
// same as %eof, sooner or later this is normal
ReturnVar=*off;
Other;
// alert the troops!
ReturnVar=*off;
EndSl;
return ReturnVar;
/end-free
P FetchCursor E

/eject
P CloseCursor B
D CloseCursor PI like(ReturnVar)
D ReturnVar s n
C/EXEC SQL
C+ Close C1
C/END-EXEC
/free
Select;
When sqlstt='00000';
// cursor was closed, normal
ReturnVar=*on;
Other;
// alert the troops!
ReturnVar=*off;
EndSl;
return ReturnVar;
/end-free
P CloseCursor E

Rob Berendt

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 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.