Pages

Friday, December 27, 2019

RPGPPOPT Keyword on CRTSQLRPGI

RPGPPOPT Keyword on CRTSQLRPGI

I have always ignored the Keyword RPGPPOPT until I have faced the strange issue with Compiling my SQLRPGLE code which hasn't really modified for last couple of years.

After a little investigation I have found that the recent upgrade has changed the default value for keyword 'RPGPPOPT' to '*NONE'.

RPG preprocessor options . . . .   *NONE 
                                         
  *NONE - The compiler is not called for preprocessing
  *LVL1 - The compiler is called for preprocessing to expand /COPY and handle the conditional compilation directives except the /INCLUDE directive
  *LVL2 - The compiler will be called for preprocessing to expand /COPY and /INCLUDE and handle the conditional compilation directives

When we use CRTSQLRPGI, SQL precompiler would first validate SQL statements. However, some times the variables which are needed by the SQL statements would reside in the source code mentioned under compiler directives such as /COPY, /INCLUDE, /DEFINE, and /IF. This would cause the compilation failures.

It is always important to check for RPG Pre-processor Options (RPGPPOPT) while compiling the SQLRPGLE (specially if we use compiler directives).

Or, It would be easier, if we could default the Preprocessor Option to '*LVL2' (or '*LVL1' as required, Please see the description above against each of this value). instead of '*NONE' (default supplied by IBM).

Below is the command we could use to change the default.

CHGCMDDFT CMD(QSQL/CRTSQLRPGI) NEWDFT('RPGPPOPT(*LVL2)')

Last thing, This default would be reset to '*NONE' if there is an upgrade performed and the default value needs to be changed again.

Popular Posts