Page 1 of 1

Number of elements for an array with DIM(*AUTO) in debug

Posted: Tue May 05, 2026 6:54 am
by peder udesen
If I have an array with DIM(*AUTO) how can I see the number of elements in debug?

dcl-s elmRtex like(elmRte_fixed) dim(*auto : 60000) ascend;

For example elmRtex is loaded with a lot of values but how many elements are there?

And yes, I know, I could put a statement in the source like this:
nbrElmRtex = %elem(elmRtex);
But this shouldn't be necessary or not allways a possibility.

Regards
Peder

Re: Number of elements for an array with DIM(*AUTO) in debug

Posted: Tue May 05, 2026 4:03 pm
by jonboy49
This should really be in the RPG forum but ...

In debug simply use _QRNU_VARDIM_ELEMS_arrayname to see the number of active elements. It cannot be changed - only viewed.

Re: Number of elements for an array with DIM(*AUTO) in debug

Posted: Wed May 06, 2026 7:18 am
by peder udesen
Thank you very much.
I used it immediately and it worked like a charm.

Well I was not sure where to put my question.
The question was about the debugger and not directly about RPG even though
it was related to a RPG program.

Regards
Peder