there is no link to type of program, a source prog when compiled produce a *MODULE (command CRTCLMOD, CRTxxxMOD).
but there is link with activation group, a parameter that belong to program creation (CRTPGM).
If you are not familiar with activation group and have no help on it, bypass the error by specifying always *dftactgrp.
an activation group is laike a sub-job, it has it's own file descriptors.
That means you can open simultaneously (for a job) the same file one time in input, one time in output but within different actgrp.
Usefull when opening files that belong to a supplier package : interferences are minimized.
There is a explaination on Activation group in the red book ile concepts, I have forgot the file name.
If you're compiling as ILE, then neither your CL nor your COBOL programs should be created to run in *DFTACTGRP. Instead, create them to run in the *CALLER activation group. In that way, the programs will have the full ILE structure; but the "caller" will almost always be an OPM program unless you change to have an ILE program issue the call. You'll run in the default activation group until you choose not to.
In addition, your CL and COBOL will run in the 'same' activation group together, even if you later start them from somewhere else.
If the problem is related to your use of OPNQRYF, it's probably because your overrides aren't scoped to cover both programs. By running both programs in the same activation group, it won't matter if the overrides are scoped to the job or only to the activation group.