CompTech810
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!!
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!!
In free form or RPGIV?
In your example, it looks like you're chaining with an array element?
Define the field1, field2, field3 etc in a Datastructure and do an overlay with an array
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks! I really thought there was an easier solution that I did in the past.