Table Procedures, Procedures and Functions are generically called Routines. They can abend with an 0077 error.
In general, a 0077 error indicates a problem binding a run-unit: either a DML statement was issued before the BIND RUN UNIT; or the run unit was bound more than once; or a similar situation. In the case of table procedures and other routines, the most common cause of this is having the subschema-ctrl area defined in a part of the program that is not being successfully accessed. For maximum success, and to avoid the 0077 errors, define the subschema-ctrl in the local work area or the global work area; or specify SUBSCHEMA-NAMES LENGTH IS 18 in the Environment Division if the routine is a COBOL program.
If Subschema-ctrl is defined in the COBOL working storage area, and then moved to a variable in the local or global work area, IDMS will save the address of the subschema-ctrl passed by the routine. Since this address is in working-storage, if the default of SUBSCHEMA-NAMES LENGTH IS 16 is specified, then the address can change on subsequent calls, which will cause IDMS to issue the 0077 since the indicated storage no longer holds the subschema-ctrl.