In a single CL Program, can we read a database file more than once?

25 pts.
Tags:
AS/400 Database File
CL Program
CLLE
Database Files
In a single CL Program, can we read a database file more than once

Software/Hardware used:
AS400

Answer Wiki

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

you can use POSDBF to reposition the file to *START to re-read it

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
    You don't tell us what version your system is at, so it's hard to know the right answer. If you're at v6.1 or later, review Reading a file twice in CL before anything else. If you're at V5R4 or earlier, then a single CL program cannot read the same file again after reaching end-of-file. That's simply the way it works. CL is a control language not a database processing language. You can work around it it two general ways. You can split your program into two programs -- one for an outer control structure and the other for the file-processing portion. The outer control code would call the inner program twice (or as many times as needed.) Or you can use RTVMBRD or a similar function to retrieve the number of records in the file before you start to read it. As you read records, keep count of them and compare your count to the number of records in the file's member. Stop reading after you have counted as many are in the file. If you try to read one more than that, end-of-file will be reached and you can't go beyond that. But if you stop just before end-of-file is signaled, you can reposition back to *START and read again. Tom
    125,585 pointsBadges:
    report
  • dinuas400
    Yes using OVRDBF we can read a file again from the starting...
    510 pointsBadges:
    report
  • TomLiotta

    Yes using OVRDBF we can read a file again from the starting…

    No, you can't.

    There are ways of doing it, but OVRDBF isn't one of them.

    Tom

    125,585 pointsBadges:
    report
  • RamvishakRamesh
    If the file has reached EOF,then OVRDBF will not help, however if version is V6R1, we can close the file and next RCVF will read the file from the begining.
    2,505 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