Physical File Without Key

20 pts.
Tags:
CHAIN
Physical File
RPG/400
RPGLE
SETGT
SETLL
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.

PlanoFSXer

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

Hi,

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.

Regards,

Martin Gilbert.

Hi,

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.

Regards

KHADAR.

//////////////////////////////////////////
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.

Phil
/////////////////////////

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

    12,700 pointsBadges:
    report
  • Splat
    FWIW, CHAIN can be used with non-keyed physical file - the search argument is the relative record number.
    7,395 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