IBM Support

Resolving CRTSQLRPGI that fails with RNF7030,RNF7503 using RPGPPOPT(*LVL2)

Question & Answer


Question

What is causing RNF7030 & RNF7503 on CRTSQLRPGI?

Answer

When you use CRTSQLRPGI, by default, the SQL precompiler first looks at the source, identifies SQL statements, and inserts the RPG code needed to execute the SQL statements, then uses the updated source and invokes the ILE RPG compiler. However, the SQL precompiler does not know how to process compiler directives such as /COPY, /INCLUDE, /DEFINE, and /IF. This can cause your compile to fail in a variety of ways depending on the specifics of your program, commonly with RNF7030 The name or indicator is not defined and/or RNF7503 Expression contains an operand that is not defined.

To get around this, you can specify RPGPPOPT(*LVL2) on your CRTSQLRPGI command, this will cause the ILE RPG compiler to process the compiler directives before passing control to the SQL precompiler. Since the conditional directives have already been processed, all the variables needed by your SQL statements will be defined.

The shipped value is currently RPGPPOPT(*NONE). There are no drawbacks to specifying RPGPPOPT(*LVL2), so you could consider changing your command default to use RPGPPOPT(*LVL2). If you use change management software, you may be able to set a default there. IBM is considering changing the shipped default to RPGPPOPT(*LVL2) in a future release.


Here is how you could change the default:
CHGCMDDFT CMD(QSQL/CRTSQLRPGI) NEWDFT('RPGPPOPT(*LVL2)')

Keep in mind, when you change the default for an IBM command, if the command is PTFd, the new command will revert back to the shipped default which is currently RPGPPOPT(*NONE), so you would have to change it again. The same is true when you upgrade to a new release.


This topic is covered in Embedding SQL statements in ILE RPG applications that use SQL in Knowledge Center:-

Using directives in ILE RPG applications that use SQL

[{"Product":{"code":"SWG60","label":"IBM i"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Programming (Languages- compilers- tools)","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}},{"Product":{"code":"SWG60","label":"IBM i"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
18 December 2019

UID

nas8N1021769