Reading physical file in reverse order by rpg/400 program

1485 pts.
Tags:
reading Physical file
Dear all,

How to read a physical file in reverse order by rpg/400 program,condition is there is not any key field in this file.

Thanks



Software/Hardware used:
AS/400

Answer Wiki

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

Hi 6r,

You can set the Pointer at the End of file, using <b>SETGT</b> & <b>*HIVAL</b>.
Use <b>READP</b> for reading the file in Reverse order.

Pradeep.

Discuss This Question: 8  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
  • pdsathishkumar
    just simple coding for you.. follow this.. F emp if e disk -> declare my PF C *hival setll employee -> set high value in pf record C dow not %eof C readp employee C empno dsply C enddo C eval *inlr = *on
    3,790 pointsBadges:
    report
  • philpl1jb
    Logic issue If there are 8 records empno is displayed 9 times Why? Also, better to code %eof(employee) Why? Phil
    49,435 pointsBadges:
    report
  • pdsathishkumar
    your correct Mr. Phil, but i got error on the %eof line error is -> Parameter EMPLOYEE is not valid for built-in function %EOF.
    3,790 pointsBadges:
    report
  • philpl1jb
    Yes, %eof(EMP) <- file name not record format name
    49,435 pointsBadges:
    report
  • TomLiotta
    ...read a physical file in reverse order by rpg/400 program,condition is there is not any key field... If there is no key, how are you defining "reverse order"? Do you want them in the reverse order that records were added to the file? Do you want them in reverse order based on relative record number? Do you want to read them in reverse order of the values of fields in the file? (They don't have to be "keys" to do that.) Or do you have a different definition? Each way can have a different method. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    ...by rpg/400 program And does it have to be RPG/400? Why not use RPG from this century? Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Thanks Tom The code samples shown responding to this question pass muster for RPG IV but are not RPG/400. Phil
    49,435 pointsBadges:
    report
  • TomLiotta
    @Phil: We know it often doesn't really matter. But it's disturbing how often it actually does. 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