Read/write Form file with same fields.

1420 pts.
Tags:
RPG/400
Hi all, I am reading from file PF1 with a record format R1 And based on some criteria/calculations i am writing the data to another file PF2 with same field names as PF1. I think Prefix is useful in this case, if so for which file i need to specify the prefix while declaration?

Software/Hardware used:
RPG400.

Answer Wiki

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

Discuss This Question: 4  Replies

 
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
  • TomLiotta
    Why would PREFIX be useful? -- Tom
    125,585 pointsBadges:
    report
  • Sai4AS400
    Hi Tom,
    i thought it would do the job. Can u please tell me how to go about this..Thanks.
    1,420 pointsBadges:
    report
  • philpl1jb

    Without the prefix, you can

    Read PF1

    Determine if you want to write to PF2

    Update specific field values if necessary

    Write PF2 .. all fields will get the values of the PF1 fields with the same name.  (sometimes referred to as an undocumented move).

    If you use a prefix on one of the files you will have to code each of the fields that you want to move. 

    Either solution will work fine.

    Phil

    49,425 pointsBadges:
    report
  • TomLiotta

    The "RPG400" tag is probably incorrect since the question is about prefixing. Only ILE RPG has that feature. It isn't clear what OS version is used, so available features aren't known.

    If two DSs are manually defined with only fields that match between the files, the input DS can be copied to the output DS in a single operation easily. But EVAL-CORR could work, too, even if the DSs are auto-generated with EXTNAME() -- not with PREFIX, though, because it changes the names.

    I suppose that the biggest question would simply be why DSs are needed at all. Without them, there wouldn't be any concern at all about PREFIX and changed names. The matching fields would automatically receive the values.

    Tom

    125,585 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