Modifying the default compiler configuration

The default options used by the cob2 command are obtained from the configuration file, which is by default /opt/ibm/cobol/1.2.0/etc/cob2.cfg. You can display the options used by cob2 by specifying the -# option on the command.

About this task

If you are using the default configuration file, the command cob2 -# abc.cbl displays output that looks like this:


exec: /opt/ibm/cobol/1.2.0/usr/bin/cob3_64 -qADDR(64) hello.cbl
exec: /usr/bin/gcc -m64 -shared -fPIC -rdynamic -fasynchronous-unwind-tables 
-Wl,--hash-style=gnu -Wl,--export-dynam -Wl,-Bsymbolic -Wl,--build-id 
-Wl,--enable-new-dtags -Wl,-zrelro -Wl,-znow -Wl,-zdefs -Wl,-z,noexecstack 
-Wl,-znotext -pie -fPIE -fwhole-program -Wl,--as-needed -Wl,--no-allow-shlib-undefined 
-Wl,--push-state -Wl,--allow-shlib-undefined -Wl,--pop-state -L/opt/ibm/cobol/1.2.0/usr/lib/ 
-L/opt/ibm/cobol/rte/usr/lib/ -lcob2_64s -lcob2_64r 
-Wl,-rpath,/opt/ibm/cobol/rte/usr/lib/:/opt/ibm/cobol/rte/:
/opt/ibm/cobol/1.2.0/usr/lib/:/opt/ibm/cobol/rte/usr/lib/:/opt/ibm/cics/lib 

You can modify the cob2.cfg configuration file to change the default options.

Instead of modifying the default configuration file, you can tailor a copy of the file for your purposes.

Note: The compiler interprets certain shell scripting characters as follows:
  • An equal sign (=) is interpreted to a left parenthesis, (
  • A colon (:) is interpreted to a right parenthesis, )
  • An underscore (_) is interpreted to a single quotation mark (')

You can add a backslash (\) escape character to prevent the interpretation and thus to pass characters in the strings. If you want the backslash (\) to represent itself (rather than as an escape character), use the double backslash (\\).

Related tasks  
Tailoring your compilation