Physical File Without Key

20 pts.
Physical File
Hi guys, Currently i'm using RPGLE language. If i have a Physical File that without key, How am i going to set my pointer. I can't CHAIN,SETLL and SETGT as well. In order to use them, u need have a key. Am i rite? Is there any idea to solve this matter? Thanks!!!!

Answer Wiki

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

To add to Khadar’s response below, you might want to think of using the OVRDBF with a KEYFLD parameter on a field in the PF, which you can use as a keyed PF in your RPG(LE) pgm.


// —————————————————————————


You can define the file without a key on your F spec, which will allow you to process the file by relative record number. You can then SETLL and SETGT using record number as the key. Normally you would SETLL with 1 to get to the start of your file and read from there on.

Your other option would be to build a logical file over your physical and use the logical in your RPG.


Martin Gilbert.


You can use a CL-Command to point like this :–
OVRDBF FILE(File-name) TOFILE(Library/File-Name) POSITION(*star/*END/*RRN)

You can point like this way.



Typically when a file is open you are at the beginning
You can use the read command to read one record at a time
and loop to process all of the records.

If you need specific records check for logical files using the command DSPDBR.
Create a logical if the number of records is large and/or you need the data is a specific sequence.
You can also process this file using SQLRPGLE.


Discuss This Question: 5  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.
  • ReshmaG
    Hi can also use *Start with SETLL for a non-key file. Regards Reshma
    455 pointsBadges:
  • ToddN2000

    Depends on how you want to process this file. You can go old school and process it as an input, primary file.

    FMYFILENAMEIP   E             DISK     

    This way it process all records in file from RRN1 to *EOF. If you need to use CHAIN, SETLL and SETGT then why not create a logical in the keyed sequence you need,

    136,250 pointsBadges:
  • Splat
    FWIW, CHAIN can be used with non-keyed physical file - the search argument is the relative record number.
    12,915 pointsBadges:
  • Arash1
    Hi, Define the file in F-Spec and use Setll *Start to set the pointer at the first record.     
    0 pointsBadges:
  • vivsande
    Great Answers!
    10 pointsBadges:

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.

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


Share this item with your network: