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 resolve this, you need to 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.

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

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Document Information

Modified date:
09 December 2024

UID

nas8N1021769