Setting compiler options using the precompiler commands

The COMPILEOPT string is available on the precompiler command and on the SET OPTION statement to allow additional parameters to be used on the compiler command.

The COMPILEOPT string is added to the compiler command built by the precompiler. This allows specifying compiler parameters without requiring a two step process of precompiling and then compiling. Do not specify parameters in the COMPILEOPT string that the SQL precompiler passes. Doing so will cause the compiler command to fail with a duplicate parameter error. It is possible that the SQL precompiler will pass additional parameters to the compiler in the future. This could lead to a duplicate parameter error, requiring your COMPILEOPT string to be changed at that time.

If "*EVENTF" is anywhere in the COMPILEOPT string specified on the precompiler command, the precompiler will behave as if "OPTION(*EVENTF)" was specified on the precompiler command. This does not apply to the COMPILEOPT string specified on the SET OPTION statement.

If "INCDIR(" is anywhere in the COMPILEOPT string, the precompiler will call the compiler using the SRCSTMF parameter.

EXEC SQL SET OPTION COMPILEOPT ='OPTION(*SHOWINC *EXPMAC)
				 INCDIR(''/QSYS.LIB/MYLIB.LIB/MYFILE.MBR '')';