Diagnostic Reference

GOTO and CABxx must name a TAG that exists. A branch to a label declared nowhere is rejected - it also carries IBM's own code rather than a TRN code, for the same reason as the table above.

Code Message Cause
RNF7043 Target {name} of GOTO or CABxx operation is not a TAG or ENDSR; the specification is ignored A GOTO or CABxx naming a label that no TAG declares.

A TAG nested inside a block - an IF, DOW, DOU, FOR, SELECT or MONITOR body - is a perfectly good target: nesting scopes storage, never label names, so a branch may reach it from inside the block, from deeper in, or from outside entirely.

Note IBM's wording, "the specification is ignored": the branch would simply fall through to the next statement. It is still a severity 30 error there and no program object is produced, so rpgc rejects it rather than compiling a program IBM would refuse to build.

These operations are fixed-format only. RPG IV never carried GOTO, TAG or CABxx into free-form, so writing one there is a syntax error (TRN0001) rather than this diagnostic.