Page 1 of 2

looping for each record

Posted: Mon Feb 05, 2007 11:03 am
by karthikraju
i need to perform a for loop logic for each of my input record. can i write this logic in a procedure and call it.

please let me know what is the best option.

Posted: Mon Feb 05, 2007 11:05 am
by narasimha
You may want to look into the option of Loops in Job Sequence. If you choose that path, you can check the posts discussed on the same.

Posted: Mon Feb 05, 2007 11:12 am
by karthikraju
But i need to perform the loop operation for each record.
if i am right,in job sequence i can only run the entire job in loops.

Posted: Mon Feb 05, 2007 11:17 am
by DSguru2B
You can write a stored procedure, yes, you can even write a C function. What exactly do you want to do?

Posted: Mon Feb 05, 2007 11:19 am
by karthikraju
I want to know will there a hit on performance if i am using a store procedure.

Posted: Mon Feb 05, 2007 11:26 am
by narasimha
May be there is a way to do in loops, but difficult to say, without getting a complete picture of what you are trying to do.
Can you elaborate please.

Posted: Mon Feb 05, 2007 11:32 am
by DSguru2B
karthikraju wrote:I want to know will there a hit on performance if i am using a store procedure.
Depends upon your input. Keep in mind that the stored procedure will be called for each record. A C routine will be faster.

Posted: Mon Feb 05, 2007 11:38 am
by karthikraju
i need to implement the following logic in loop


i get a 10 digit value in string format a the input.
i should take each digit places from 1 to 10 and divide them with 2. if my remainder is 0 then i need to store it in a variable and keep adding it up till my loop is finished.
at the end of my loop that value becomes my 11th digit.

Posted: Mon Feb 05, 2007 11:43 am
by chulett
A check digit, in other words. Best to do that in C, I would think...

Posted: Mon Feb 05, 2007 11:47 am
by karthikraju
Can you please let me know how to compile and link it the job.

Posted: Mon Feb 05, 2007 11:49 am
by DSguru2B
What compiler option do you have. If you have aCC, then you can use acc +Z yourfunction.c
That will create the object file. Create a px routine from the manager, give it a name, external function name will be the name of your c function. Give the path of the object file.

Posted: Mon Feb 05, 2007 11:53 am
by karthikraju
can you let me know where can i check my compiler options.

Posted: Mon Feb 05, 2007 12:46 pm
by DSguru2B
Depending upon your compiler, you will provide the options. It will be present in APT_COMPILEROPT environment variable.

Posted: Mon Feb 05, 2007 1:11 pm
by karthikraju
i got the following options in APT_COMPILEROPT and my compiler is g++.

-O -fPIC -Wno-deprecated -c

Posted: Mon Feb 05, 2007 1:36 pm
by ray.wurlod
Rather than asking "will it work?" why not try it?