What is field reference file in RPG ILE

310 pts.
Tags:
Field Reference File
RPG
RPG ILE
Hi all, I'm working on RPG ILE. Please tell me what is field reference file, what is use of it, please give any example. Thanks, Ambrish

Answer Wiki

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

FRF is the reference of physical file,means it in that company we want particular fields name, there gives criteria then you can access particular fields through FRF.


use file level keyword to retrive the fields. “REF(PF NAME)”. RECORD NAME MUST BE SAME


 

Discuss This Question: 15  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.
  • Mohan K
    Hi Gilly, i have one question which regards to your above explination. For example i have created 1 physical file FILEA with 10 fields in that PF by referencing each field from field reference file(FLDREFFILE). if i have populated the 10000 records of data to the file FILEA from production. after moving the file to production later on if i receive a request from client saying that FIELDA length needs to be changed from 10 character to 30 character in FILEA. in this case i can not change the field FIELDA length in FILEA, since i am referencing this field from REFFILE. if i want to change the field length from 10 character to 30 character in FILEA with out compiling the FILEA and with out losing the data in FILEA what should i have to do. Please suggest me. Thanks Mohan K.
    695 pointsBadges:
    report
  • Teandy
    I don't think you can change a field length in a file without recompiling it and the programs that use it. Even if you can, I think it would be extremely foolish, not to mention dangerous, to do so. Here is what I would do: First make a back up of the original file. CPYF FROMFILE(MYLIB/FILEA) TOFILE(MYLIB/FILEABAK) MBROPT(*REPLACE) CRTFILE(*YES) Second, change the dds for FEILDA from 10 to 30 and recompile the file. Third, copy the data from the back up back to the original file. CPYF FROMFILE(MYLIB/FILEABAK) TOFILE(MYLIB/FILEA) MBROPT(*REPLACE) FMTOPT( *NOCHK) Fourth, recompile the programs that use the file.
    5,860 pointsBadges:
    report
  • graybeard52
    To change the length of a field that has DDS defined, just fix the DDS and run CHGPF. You will then need to recompile any RPG programs that use the file, since you have now changed the file level. If you use CRTPF you will lose all you data, so use CHGPF instead.
    3,115 pointsBadges:
    report
  • RamvishakRamesh
    I have a query, I have a field reference file with say 10 fields and I have some files which refer to this field reference file, Is it possible to delete the field reference file now?
    2,505 pointsBadges:
    report
  • Brijesh
    Check this http://as400onlinecourse.blogspot.in/2012/12/field-reference-file-in-as400.html which may assist you with some idea.
    14,450 pointsBadges:
    report
  • Balaji07
    Hi, could you please explain me FRF, why it is, what is the use this and when it is needed? Please help!
    30 pointsBadges:
    report
  • ToddN2000
    A field reference file is like your "mother of all files". You define your fields in one place. Then in all the other files you create you reference this file when compiling. This can make life much easier when it comes time for changes. You edit the field reference file, then just recompile the files and programs using the field you changed. This way you do not need to go into each DDS, RPG, ILE or other piece of code and change the definition manually.
    89,455 pointsBadges:
    report
  • azohawk

    The FRF if used properly will help you avoid situation where part of the system has item number defined as 7char and another part as 8 numeric (I have witnessed this). When you build individual files, the fields are built based on the equivalent fields in the FRF.

    In the case where you need to change the size of a field. You will want to a) change the FRF, and recompile the FRF. B) do not recompile the PF-use the CHGPF as mentioned earlier. If you recompile the file, you will loose your data.--repeat for any other PF that reference the same FRF field. C) recompile LF (first), DSPF and PRTF that refence the PFs that you changed (or the FRF field) (second). Finally recompile the programs that reference the files that were updated.

    Depending on how wide spread the change is, this takes planning to determine all of the affected objects. Plan to do this when you can have exclusive access to all of the objects.

    2,905 pointsBadges:
    report
  • ToddN2000
    @azohawk: Yes I should have added the fact the recompiling will cause the loss of data. We get changes like this from our software vendor when new releases come out on occasion. We have utilities that copy the files in question to a savelib then recompiles everything, then copies the data back into the newly compiled version using the FMTOPT(*MAP *DROP).
    89,455 pointsBadges:
    report
  • Balaji07
    Thank you for your valuable information ToddN2000 and azohawk.
    30 pointsBadges:
    report
  • Balaji07
    In CL, what is the use of DataAreas? Why we need it? Could you please make me understand?
    30 pointsBadges:
    report
  • ToddN2000
    @Balaji07: A data area in a CL may be used to control how a program runs or functions. An example might be using it as a flag. Say you are printing invoices. You can have a data area contain a Y / N or even a numerical value for something like number of copies needed. When the print program gets ready to run in the CL , check the data area and then you can set the number of copies in an OVRPRTF before the call of the print program.
    89,455 pointsBadges:
    report
  • Splat
    Data areas can also be useful when you need to make note of various stages of a process.
    11,455 pointsBadges:
    report
  • ToddN2000
    @Splat: Good point forgot about those. Bac in the 90's I worked for a company that had MASSIVE batch jobs. The CL may have called 70 to 100 jobs. We used data areas to record the last step completed in the CL. If a failure occurred we could fix the issue and re-launch the job starting at the step that failed.
    89,455 pointsBadges:
    report
  • azohawk
    I have also encountered data areas being used to track last check or invoice number used. Also encountered data areas used to allow/not allow certain jobs to start (call program to start a job, checks the data area, data area has an N in it, do not start the job). Example of this, we do not allow the data to flow from our floor data collection to the ERP module until after we have checked it during physical inventory (to many cases where people enter events that are not PI related). The rest of the year, this is started as part of our daily system start following backup.
    2,905 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.

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

Following

Share this item with your network: