Writing to a file with a data array

pts.
Tags:
RPG ILE
Have a PF with 50 fields named COUNT1, COUNT2, ... COUNT50. Wondering how I can read an array and loop each time x increments 1, put the value in the corresponding field? example AR1(x) goes to COUNT1 when x = 1, AR1(x) goes to COUNT2 when x = 2.

Answer Wiki

Thanks. We'll let you know when a new response is added.

I only know of one way to accomplish this. Setup a Data Structure in the program and list each field and overlay the definitions with an array name. Then you can refer to the elements with an index. Example:
dorders ds
d ords 1 65s 0 dim(13)
d ords01 1 5s 0
d ords02 6 10s 0
d ords03 11 15s 0
d ords04 16 20s 0
d ords05 21 25s 0
d ords06 26 30s 0
d ords07 31 35s 0
d ords08 36 40s 0
d ords09 41 45s 0
d ords10 46 50s 0
d ords11 51 55s 0
d ords12 56 60s 0
d ords13 61 65s 0

Then in the calculations you can use:
eval ords(w) = ords(w) + ordqty ;

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TSTOKES
    What are you using to ready the PF...RPG, Synon 2E, other? If you are using 2E, you can do this with a external and retrieve function on the PF and a retrieve function on the array.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following