Hi All
I have recently started to learn RPG and I am currently trying to find the bext way of doing things so appologies if this is a simple question!
I currently have a display file containing one format. This format contains 20 fields which are identical in type and are all name in the followwing manner:
S_Num1, S_Num2, S_Num3........S_Num20
My question is can I use a loop within my RPG which writes a given value to each one of these fields in turn without me having to repeat the code for each field. For example what I would like to do is something similar to the following:
For i = 1 to 20
S_num(i) = 'Field' &" "& i
i +=1
Next i
I no that you can do this is Visual Basic via a control array but I dont know if this is possible in RPG and if so the best way to go about this. Any suggestions would be very welcome!
Thanks in advance
C
I have recently started to learn RPG and I am currently trying to find the bext way of doing things so appologies if this is a simple question!
I currently have a display file containing one format. This format contains 20 fields which are identical in type and are all name in the followwing manner:
S_Num1, S_Num2, S_Num3........S_Num20
My question is can I use a loop within my RPG which writes a given value to each one of these fields in turn without me having to repeat the code for each field. For example what I would like to do is something similar to the following:
For i = 1 to 20
S_num(i) = 'Field' &" "& i
i +=1
Next i
I no that you can do this is Visual Basic via a control array but I dont know if this is possible in RPG and if so the best way to go about this. Any suggestions would be very welcome!
Thanks in advance
C
Comment