AS/400 ILE

90 pts.
Tags:
AS/400
ILE
Physical File
Hi, I want to ask the question about the physical file and logical file which with the members. Anyone could help me please? eg. PH 'A' with 5 members, so how about LF 'A'? Is it should be 5 members also? or we still need to add in? How about the data in the members?

Software/Hardware used:
AS400

Answer Wiki

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

Discuss This Question: 16  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
    We don't know. It depends on why the PF has multiple members, and why the LFs exist, and how they all are used. It depends on what the application needs. . In short, it all depends on how the application design is intended to work. . If the LFs need members that match the PF, then the members need to be added to the LFs. . Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    One minor note for clarification... "ILE" has nothing to do with PFs, LFs and database file members. The question title isn't related to the question you asked. . It's not clear if you understand what "ILE" means or if you have some deeper problem that you haven't mentioned yet. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    See http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Fcl%2Fcrtlf.htm Especially DTAMBRS when the logical file is created with the defaults it will create a member with the same name as the logical and mapping all the current members of the physical file. Add Logical File Members will allow you to create separate members of the logical mapping one, multiple, or all current members of a physical file in one logical file member. http://publib.boulder.ibm.com/html/as400/v4r5/ic2962/info/cl/addlfm.htm
    51,305 pointsBadges:
    report
  • philpl1jb
    My answer will be along in awhile .. however .. Search AS/400 Create Logical File and Search AS/400 Add Logical File Member I these commands you can specify which physical file members are mapped by a logical file member.
    51,305 pointsBadges:
    report
  • philpl1jb
    Creating a logical file will create a single member .. the defaults will map all existing members in the Physical into the single logical file member. The ADDLFM command can be used to create other members in the logical file and map one or more members into that logical.
    51,305 pointsBadges:
    report
  • yeepiyaya
    ops...I mistype the header...sorry. actually should be like this...i have a physical file with multiple member and i need to update some of the members, that's why I've created a CL to override the member and RPG. However, the key is different. That's why I need a logical file and I not sure whether it can be work or not. Thanks
    90 pointsBadges:
    report
  • philpl1jb
    As I described above you can add a logical file member for each physical file member. You can do an ovrdbf to the logical file member desired. or In RPGLE(RPG IV) you can use the extmbr keyword on the F spec to identify the member. If you use a variable for the EXTMBR value it must be populated before the file is open .. perhaps using USROPN. or If you are using SQL you can create alias associated to each member of the physical file.
    51,305 pointsBadges:
    report
  • yeepiyaya
    EXTMBR keyword? hmm...actually I'm still new in this language. Lot's of function keyword i still haven't learn it yet. but I just only can understand about the PFand LF but not with it's member. That's why I'm not sure if let say PF 'A' got member 1,2,3,4,5, how about the LF 'A'? Is it it must contain the members? or if LF 'A' also got the same members 1,2,3,4,5 with the PH. is the data will be same?
    90 pointsBadges:
    report
  • TomLiotta

    A logical file (LF) is built over data in a physical file (PF). The LF can be over any member of the PF, or over a list of members, or over *ALL members. Most likely, a LF member will be over a matching PF member by name.

    You can list the members of a PF or LF with DSPFD. You can see the data in a PF or LF member with RUNQRY. (Specify the member name with the file name.)

    For a program, you can use OVRDBF to choose any member if you do it outside the program. With ILE RPG, you can do it inside the program with the EXTMBR() keyword.

         F file1    IF   F   10        DISK    EXTMBR('MYMBR')

    You can use a constant or a variable:

         F file1    IF   F   10        DISK    EXTMBR( cdmbr )
         D CDMBR           c                   'MYMBR'

    The value in the constant or variable must be upper-case. If you use a variable, it can be passed in as a parm or the program can set the value before it opens the file. If you set a new value in a variable after the program starts to run, you also need to use the USROPN keyword and run the OPEN op-code to open the file.

    Tom

    125,585 pointsBadges:
    report
  • philpl1jb
    Of course, if the rest of your application uses OVRDBF to select the member, it makes a lot of sense to stay with that model.
    51,305 pointsBadges:
    report
  • TomLiotta
    I'll agree that it's sensible to stay with current application standards for someone who is learning. In the long run, though, I would think about transitioning away from OVRDBF if all it does is set a particular member, particularly if it requires a separate object to do it. (I'd be less concerned about an additional bound module.) . Tom .
    125,585 pointsBadges:
    report
  • yeepiyaya
    Thanks for helping. But in this case, I want to read all the members in the PF. That's why I will override all the members. Just no idea how to do it in LF.
    90 pointsBadges:
    report
  • philpl1jb
    Use DSPFD on the LF Find if a member maps all current members of the PF If no member includes all physical file members then you can add a physical file member with the member list of *ALL That's the member you want to use .. it will provide all rows of all current member. If each logical file member maps to a single physical file member you can do an OVRDBF of the logical file to member *ALL The problem with this strategy is that if/when a member is added to the physical, they will not be included in the logical file member.
    51,305 pointsBadges:
    report
  • philpl1jb
    All the members as a single set or one member at a time?
    51,305 pointsBadges:
    report
  • yeepiyaya
    Oh...ok...I wan to read one member at a time. If not because of the key is different, I will not think about the LF.
    90 pointsBadges:
    report
  • TomLiotta

    If not because of the key is different...

    Different?

    Different from what? Different between 'what' and 'what'? The key definition will be the same for every member in a file. The key "values" can be different for every record in a file. The key "definition" can be different for each file.

    You can create a LF with any key definition that you need. And you can create with *ALL members from the PF.

    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