I am looking for some example 'C' code that will allow me to pass 12
numeric variables from an SQLRPGLE program to a 'C' program that will
calculate the geometric mean for them and return the value to the SQLRPGLE
I found an example where an RPG program will pass two character fields to
a 'C' program which will concatenate and return them, however I know
nothing of 'C', its syntax, or setting it up with an 'int' or 'void' to get
my example to do what I want.
Currently, this is the 'C' code example I am working with:
/* Main program. */
int main(int argc, char *argv)
parameters sent to the program. */
printf("Incoming parameter 1 = %s\n", argv);
printf("Incoming parameter 2 = %s\n", argv);
Concatenate the two incoming parameters into the third parameter. */
End of program. Returning with concatenation of parameters 1 and 2 into
parameter 3. */ return;
I have found a 'C' program example that calculates the geometric mean I am
looking for, but it is set up as follows:
x1=2,x2=4,x3=6,x4=7,x5=6; double x,N=5;
x=pow(x,(1/N)); printf("Geometric Mean for
Xn: %lf",x); return 0; }
I believe I would need to set up x1=argv, x2=argv and so on, but I
do not believe I am setting up the variables correctly to pass back what I
am looking for.
Any suggestions would be greatly appreciated. Thanks. Regards, Stephen
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L)
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.