NODYNAM means that the DB2 module will be linked into the program.
This link may explain the problem https://www.ibm.com/support/knowledgecenter/en/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/tasks/tpdb207.htm
Enterprise COBOL for z/OS, Version 4.2, Programming Guide For COBOL programs that have EXEC SQL statements, your choice of the compiler option DYNAM or NODYNAM depends on the operating environment. When you run under: TSO or IMS: You can use either the DYNAM or NODYNAM compiler option. Note that IMS and DB2 share a common alias name, DSNHLI, for the language interface module. You must concatenate your libraries as follows: If you use IMS with the DYNAM option, concatenate the IMS library first. If you run your application only under DB2, concatenate the DB2 library first. CICS or the DB2 call attach facility (CAF): You must use the NODYNAM compiler option. Because stored procedures use CAF, you must also compile COBOL stored procedures with the NODYNAM option.