IBM i message

RNQ0222: Pointer or parameter error

RNQ0222 means an ILE RPG program used a pointer that isn't set, or a parameter that the caller didn't pass. It matches RPG program status code 00222. A program called with fewer parameters than it expects is the most common cause.

Other names for this code

Also written as RNX0222, status 00222, RPG status 222, %STATUS 222, RPG pointer or parameter error, RPG parameter not passed.

What it means

RNQ0222 is an ILE RPG runtime message for program status 00222, which IBM's ILE RPG Reference lists as a pointer or parameter error. Parameters are passed to RPG programs by reference. Each parameter is really an address. When the caller passes fewer parameters than the program expects, the missing ones have no address. As soon as the program touches one of them, the machine raises MCH3601, a pointer that isn't set, and the RPG runtime reports status 00222.

The same status covers plain pointer problems. A field declared BASED on a pointer can't be used until the pointer holds an address. A pointer that is still null, or one that points to storage that has been freed, causes the error when the program reads or changes the based field.

RNQ0222 is the inquiry form of the message, sent when the program had nothing to handle the error. The job waits for a reply, at the screen or for batch work usually in QSYSOPR. RNX0222 is the escape form. It reports the same condition without waiting and can be caught by MONITOR or a caller.

Common causes

  • The program was called with too few parameters, for example from a command line with CALL PGM(ACCTLIB/PAYCALC) and no PARM, or from a CL program written for an older version.
  • An optional parameter declared with OPTIONS(*NOPASS) was used without first checking %PARMS.
  • A parameter declared with OPTIONS(*OMIT) received *OMIT and the program used it without checking whether its address is null.
  • A field BASED on a pointer that was never set, or set to storage that has since been freed with DEALLOC.
  • The caller and the called program use different prototypes, after one was changed and the other wasn't recompiled.

How to find the problem

  1. Look for MCH3601 just above RNQ0222 in the job log (DSPJOBLOG). It confirms a pointer that isn't set.
  2. Press F1 on RNQ0222 for the procedure, program and statement number, then find that statement in the compile listing. Note which parameter or based field it uses.
  3. Check how the program was called. The job log, the calling CL source or the command used will show how many parameters were passed.
  4. Compare the number of parameters on the call with the program's prototype and interface (PR and PI) or its *ENTRY PLIST.

How to fix it

  • Pass every required parameter. When calling from a command line, give all of them in PARM.
  • For optional parameters, check %PARMS before using one. For parameters that can be omitted, test %ADDR(parm) <> *NULL first.
  • Share one prototype for each program in a copy member, so the compiler checks every call against it.
  • Set basing pointers before using based fields, and don't use storage after DEALLOC.
  • Reply C for the waiting job, then correct the call or the program and rerun.

IBM documentation

IBM Display Message Descriptions (DSPMSGD). Use the documentation for your installed release.

This link opens the relevant IBM reference library or lookup instructions. Match the complete code and your installed product release; it is not a code-specific review.

Report a correction to WND Software.

Questions

Why does the program work from the menu but fail from the command line?

The menu passes all the parameters and the command line call doesn't. A missing parameter has no address, so the first use of it gives MCH3601 and RNQ0222.

How do I make a parameter optional in RPG?

Declare it with OPTIONS(*NOPASS) on the prototype and interface, then check %PARMS in the program before using it. Parameters after it must be optional too.

Which reply should I give to an RNQ message?

C (cancel) is the safe answer when you don't know the program. D and F also cancel, but first write a dump the developers can use. G skips the rest of the current RPG cycle and resumes at its input step (*GETIN). That is a call for the program's owner to make.