Appending values to an array

I made an array and I want to populate its fields under certain conditions along my program.
So I´d like to do an “append” operation in my array. In other languages I can find statements to handle this.
Is there a “method” or a straight command to do this in Natural? Thank you!

Take a look at the commands EXPAND ARRAY, RESIZE ARRAY and REDUCE ARRAY and the accompanying discussion of X-Arrays.

If this isn’t what you are looking for, please provide some details about your use case and perhaps some simple code examples to illustrate your question.

@Douglas_Kelly I appreciate your interest, thank you!
I´ve been thinking better and in fact my need is to increment the values in the array, and not its number of fields. I’m using this array to control the amount of records that I´ll write in a work file. Here’s my idea for now ( this “FOR” loop is a “READ” in my real version ). Do you think this works?

DEFINE DATA LOCAL
1 #EXP (N2/1:3)
1 #I (N07)
1 #Q (N07)
1 #TIMN (N07) 1 REDEFINE #TIMN
2 #HHIISS (N06)
2 #T (N01)
1 #R2 (N02)
1 #R3 (N02)
1 #R7 (N02)
END-DEFINE
/*
/* JUST TAKING SOME NUMBERS TO POPULATE THE ARRAY “IN A NON-ORDERED WAY”
FOR #I FROM 11 TO 9999999 STEP 1
DIVIDE 2 INTO #I GIVING #Q REMAINDER #R2
DIVIDE 3 INTO #I GIVING #Q REMAINDER #R3
DIVIDE 7 INTO #I GIVING #Q REMAINDER #R7
DECIDE FOR FIRST CONDITION
WHEN ( #R2 EQ 0 AND #EXP(1) LE 9 ) ADD 1 TO #EXP(1)
WHEN ( #R3 EQ 0 AND #EXP(2) LE 9 ) ADD 1 TO #EXP(2)
WHEN ( #R7 EQ 0 AND #EXP(3) LE 9 ) ADD 1 TO #EXP(3)
WHEN NONE
MOVE TIMN TO #TIMN ADD #T TO #I / ATTEMPT TO GET SOME “RANDOM VALUES”
END-DECIDE
RESET #Q
END-FOR
WRITE ‘AMOUNT OF MULTIPLES OF 2 =’ #EXP(1)
/ ‘AMOUNT OF MULTIPLES OF 3 =’ #EXP(2)
/ ‘AMOUNT OF MULTIPLES OF 7 =’ #EXP(3)
ON ERROR
EJECT
TERMINATE 50
END-ERROR
END

I have read your response to Doug; but still do not understand what you are trying to explain. I am guessing there is a language problem. If so, could you get someone to re-write the explanation.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.