This is quite simple if you know the name of the program at compile time.
All you have to do in your C code is:
1. Add the #pragma clause:
#pragma linkage (progname, OS)
void progname(char *queue, char *queuelib, char *sens);
2. Just call the program like you call any other C function:
progname (queue, queuelib, sens);
When the call ends, the “sens” variable will contain the return value from the CL program.
This works for calling CL program, RPG program or any other program object.
If you do not know the name of the program at compile time, that is the C program have to call a “variable” program name, this is more complicated.
In such case, you have to resolve the pointer to the program object and use the pointer as a function placeholder.
Hope this helps.