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

Any IBM i topic that does not fit in another forum
Post Reply
peder udesen
Posts: 35
Joined: Thu Jul 29, 2021 8:00 am

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

Post 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
jonboy49
Posts: 262
Joined: Wed Jul 28, 2021 8:18 pm

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

Post 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.
peder udesen
Posts: 35
Joined: Thu Jul 29, 2021 8:00 am

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

Post 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
Post Reply