RSS Amplifier

Software AG Tech Community - Latest posts · May 18, 2026

Can *OCCURRENCE(#X-ARRAY) define the X-ARRAY memory space in execution time?

0
Sign in to vote or save

Imnacho2000 · Software AG Tech Community

1

Product/components used and version/fix level:

Detailed explanation of the problem:

Error messages / full error message screenshot / log file:

Question related to a free trial, or to a production (customer) instance?

I was encoding a program and it gave an error in execution time since it called a subroutine and when returning from it I performed a loop for from 1 to 180 consulting by #X-ARRAY(#i), it gave me the NAT1257 but a SENIOR programmer came and solved it with *OCCURRENCE(#X-ARRAY), I did not know that it could be assigned in runtime dimension that way, making the code stay

FOR #J 1 *OCCURRENCE(#X-ARRAY)

For better performance you should change the code a little. Inside the loop *OCC will be executed each time, which is a waste of time, unless you change the size of #X-ARRAY.

Try:

#IX := *OCC(#X-ARRAY)

FOR #J 1 #IX

Ellie-Mae (Ellie-Mae) 3

Nice solution. Using *OCCURRENCE(#X-ARRAY) makes the loop more flexible and avoids hardcoding the array size.

Read the original on techcommunity.softwareag.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.