Re: Call a C program from RPG with variables & a return

Stephen Mooney <stephenmmooney-/[email protected]>
Newsgroups gmane.comp.lang.as400.c
Message-ID <[email protected]>
Charles,
Thanks for the example.  I will try it this morning. Regards, Stephen M. Mooney

      From: Charles Wilt <[email protected]>
 To: Bare Metal Programming IBM i (AS/400 and iSeries) <[email protected]> 
 Sent: Wednesday, February 17, 2016 11:43 AM
 Subject: Re: [C400-L] Call a C program from RPG with variables & a return
   
As Buck points out, RPG supports double.

As does SQL.  Just use CAST or the DOUBLE() function.

set :$Geo03 = double(:Tot03) ** double(1/:$Root03)

You'd probably be best served by declaring $Tot12 as double in the first
place.  Possibly $AvgH(x) should be declared as double too.

Otherwise, you might have to cast to double for each term...which would be
ugly.

Charles


On Wed, Feb 17, 2016 at 12:10 PM, Buck Calabro <[email protected]> wrote:

> On 2/17/2016 11:29 AM, Stephen Mooney wrote:
> > Charles,
> > Thank you for your suggestion.  I was using the SQL set function after
> calculating the total for three months:
> > $Tot03 = ($AvgH(1) * $AvgH(2)  * $AvgH(3))
> >
> > SET :$Geo03  =  :$Tot03 ** (1/:$Root03);
> >
> > And that works fine.  When I try it with 12 month's, the result field is
> not large enough (set to 63P) and the program errs.  Same happens with:
> > $Tot12 = ($AvgH(1) * $AvgH(2)  * $AvgH(3) *
> $AvgH(4) * $AvgH(5)  * $AvgH(6) *                      $AvgH(7) * $AvgH(8)
> * $AvgH(9) *                      $AvgH(10) * $AvgH(11)  * $AvgH(12))
>              ** (1/12);
> > I think I need to use 'C' because if I declare the result field as
> "double" I do not have the restriction I do in RPG.
>        Regards, Stephen M. Mooney
>
> RPG supports double as dcl-s bigNumber float(8);
>
> --
>  --buck
>
> Visit wiki.midrange.com and register for an account. Edit a page that
> helps you, and because it's public, you'll help someone else, too!
>
> --
> This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L)
> mailing list
> To post a message email: [email protected]
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/c400-l
> or email: [email protected]
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/c400-l.
>
>
-- 
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.



  
-- 
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.