Link to home
Start Free TrialLog in
Avatar of CompTech810
CompTech810Flag for United States of America

asked on

DO loop through field names ending in a numeric

Hello Experts,

I have a RPGLE question concerning looping though field names instead of having multiple routines with each field name.

Exp.   I have field names FIELD1, FIELD2, FIELD3, etc.   I know in the past(I've been away from AS/400 for years) I would use a DOU loop something like this.

DOU I = 10
FIELD,I      CHAIN    FILE       99

How do I do that in RPGLE?

THanks!!
Avatar of Phillip Knox
Phillip Knox
Flag of United States of America image

In free form or RPGIV?
In your example, it looks like you're chaining with an array element?
Avatar of Theo Kouwenhoven
Define the field1, field2, field3 etc in a Datastructure and do an overlay with an array
Avatar of CompTech810

ASKER

RPGLE.   In the example it should, from what I remember, it places the number at the end of FIELD, so if it is in it's first loop the field name would be FIELD1, then next loop FIELD2, etc.   I wish I had that old code I did.   I'm thinking Murphey is close to what I did, this was in RPGIV a long time ago.
ASKER CERTIFIED SOLUTION
Avatar of Theo Kouwenhoven
Theo Kouwenhoven
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!  I really thought there was an easier solution that I did in the past.