ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Controling Multiple Screen Fields in Array (Control Array)?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Controling Multiple Screen Fields in Array (Control Array)?

    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

  • #2
    Re: Controling Multiple Screen Fields in Array (Control Array)?

    THis may be close



    welcome to code400
    Jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment

    Working...
    X