Hi,
In an RPG IV program in free format, I want to read the elements of an array in a loop till the last element of the array is read. And I have to do some operations on each array element. The array elements are strings. But I don't know how to reference each array element in a loop.
For example: If there are 2 arrays ResArray and StringArray of size 10. StringArray is an array containing 10 strings and I have to extract a part of each string in the array and put them in corresponding positions of ResArray. What will be the syntax to access an array element?
/free
DoU i = 10;
ResArray[i] = %subst(StringArray[i]:4:2);
i = i + 1;
/end-free
Can anyone let me know what will be the exact syntax for writing a code with the above logic?
Thanks,
Subha.
In an RPG IV program in free format, I want to read the elements of an array in a loop till the last element of the array is read. And I have to do some operations on each array element. The array elements are strings. But I don't know how to reference each array element in a loop.
For example: If there are 2 arrays ResArray and StringArray of size 10. StringArray is an array containing 10 strings and I have to extract a part of each string in the array and put them in corresponding positions of ResArray. What will be the syntax to access an array element?
/free
DoU i = 10;
ResArray[i] = %subst(StringArray[i]:4:2);
i = i + 1;
/end-free
Can anyone let me know what will be the exact syntax for writing a code with the above logic?
Thanks,
Subha.
Comment