Writing Records from a Display file

845 pts.
Tags:
IBM iSeries
Hi,
I am new to this technology.Cleared all the basics & started programming.I just want to add some records to a physical file from a display file, using RPG/RPGLE .Could you please let me know the outlines how to code this. 

Thanks


Software/Hardware used:
Iseries

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: 6  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
  • philpl1jb

    Here is a rough set of code to write every record in the subfile

    c          eval    rrn =1 
     *--                            get first record from subfile
    c  rrn    Chain   sfl01
    c          dow     not %eof
     *--                             populate fields in physical file
    c         eval    pffld1 = sflfld1
    c         eval    pffld2 = sflfl2
     *--                              write physical file record
    c         write   pfr
     *--                              get next subfile record
    c         eval    rrn = rrn + 1
    c  rrn   Chain   sfl01
    c         enddo

    50,860 pointsBadges:
    report
  • HABBIE
    Thanks Tom
    845 pointsBadges:
    report
  • HABBIE
    Sorry Thanks Philp

    845 pointsBadges:
    report
  • PGMBOB

    I would use a do loop to increment the SFL relative record number.

    RRN is set to 1 and increased when the enddo is reached.

    Slightly differnt with only 1 CHAIN.  

    c          do         9999                rrn 
     *--                            get first record from subfile
    c  rrn    Chain   sfl01
    c          dow     not %eof
     *--                             populate fields in physical file
    c         eval    pffld1 = sflfld1
    c         eval    pffld2 = sflfl2
     *--                              write physical file record
    c         write   pfr
     *--                              get next subfile record
    c         enddo

    Good Luck

    1,150 pointsBadges:
    report
  • PGMBOB

    Yes, The DOW not %EOF should be:

    IF %EOF 

    LEAVE

    ENDIF

    1,150 pointsBadges:
    report
  • HABBIE
    Thanks BOB
    845 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