LF pointing incorrect Physical file

1590 pts.
Tags:
Logical File pointing incorrect physical file and No source code of Logical file available.
Hi, I have a lf let's say its name is L1 which is in LIB. A. and its based on two PFs B and C. Here C physical file is present again at a same time in Let's say in TWO libraries LIB D and LIB E. Now for some programming or data retrieving purpose i have to correct my lf(LOGICAL FILE) so that it should take physical file C from Lib E only.Currently its' picking up it from Library D.But my objective is to make it based on Correct physical file C which is present in Library E. And the other physical file B is fine for my LF. I don't have any complaint for this. I also don't have source code of this Logical file. Only I have object with me. so without source code of this logical file how can i make logical file to be based on correct physical file which is presennt in Library E. Any idea suggestions without source code of this Logical file how can i achieve this target? Thanks

Software/Hardware used:
AS/400

Answer Wiki

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

How can i creat a source if we don’t know on which selection or omission criteria that lf was based on.?

Second approach :-

I think this will work: 1. rename the logical file 2. Set your library lists so you will see the correct versions of both physical files. 3. use the crtdupobj to duplicate the old logical to a new name .. it may remap the data based on the first version of each physical that it finds in the library list.
its also not working after creating another object and when i do wrkobj in it and search PFILE it still points to incorrect library.

Discuss This Question: 31  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
    so without source code of this logical file how can i make logical file to be based on correct physical file which is presennt in Library E.   You can't. (Well, I suppose you could; but the only thing I can think of would risk messing up your PFs.)   One thing you definitely can do is just create source for the LF. Recompile it when you need it. Why worry about not having source when you can just create the source?   But the best thing to do is not to use the LF at all. Use embedded SQL to open a VIEW that dynamically describes the data the way you want it whenever you need to switch.   Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    I think this will work:    1. rename the logical file  2.  Set your library lists so you will see the correct versions of both physical files.  3.  use the crtdupobj to duplicate the old logical to a new name .. it may remap the data based on the first version of each physical that it finds in the library list.  Good luck
    50,860 pointsBadges:
    report
  • 6r
    How can i creat a source if we don’t know on which selection or omission criteria that lf was based on.? Second approach :- I think this will work: 1. rename the logical file 2. Set your library lists so you will see the correct versions of both physical files. 3. use the crtdupobj to duplicate the old logical to a new name .. it may remap the data based on the first version of each physical that it finds in the library list. its also not working after creating another object and when i do wrkobj in it and search PFILE it still points to incorrect library.
    1,590 pointsBadges:
    report
  • TomLiotta
    How can i creat a source if we don’t know on which selection or omission criteria that lf was based on.?   Run DSPFD against the LF and read the description.   Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    The CRTDUPOBJ command doesn't use the library list to select based-on PFs for a LF. If new based-on PFs are wanted, they must exist in the to-file and have matching record formats with the original PFs. If there are no matching PFs in the to-file, the original PFs are used. -- Tom
    125,585 pointsBadges:
    report
  • 6r
    i tried creating a new lf based on dspfd command but for second file (which is picking up incorrect library) shows record format different. i mean on second pf when i do dspfd it shows record format same like first one. mean both pfs have common record format. but how can it be possible once i do dspfd for lf. it shows two different recods formats. lf shows 2 separate recod formats for corresponding to 2 pfile keywords whereas once i do dspfd and search in bottom then find the recods format of both the pfs same. so while compiling with same recod format this lf dds is giving error pls change recod format name means ideaaly ther can't be same record formats for a lf for 2 pfile keywords. so unable to create dds for this lf based on dspfd
    1,590 pointsBadges:
    report
  • TomLiotta
    You need to show us the information from the physical files and from the existing LF, and also show the source for your new LF. We can't make guesses. We need you to show us what you have. -- Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Perhaps this LF was created in SQL  navigator will "recreate" sql code.
    50,860 pointsBadges:
    report
  • TomLiotta
    Perhaps this LF was created in SQL   Heh. You're in an unusually humorous mood this morning.   Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    SQL where humor is null.
    50,860 pointsBadges:
    report
  • 6r
    Actually the main issue is both pfs have common record format,this i have checked using dspfd and file names one by one and at bottom when i see record format name it shows same name. But this multformat logical file which is based on these two pfs shows its based on these two files with giving two separate record format names under LF format . Just for example :- suppose i have a Logical file and it's name is MLTF. and once i do DSPFD to it and search PFILE there and see below information:_ Files accessed by logical file PFILE File Library LF Format ID1 JKJK1 REC1 ID6 JKJK2 REC4 ort Sequence . . . . . . . . . . . . . . . : SRTSEQ and once i do DSPFD for both these physical files ID1 and ID6 and go to the bottom and find their recod format is same that is REC1. So i wonder how this LF would ever have been created despite having the record format name same of these 2 PFs It's really a challenge to find the reason behind it.Hope it clarifies the exact problem and scenario. Thanks
    1,590 pointsBadges:
    report
  • TomLiotta
    So what is the problem? It looks normal to me. The record format name in a LF has no connection to the record format name in the underlying PF. In fact, you should give LF records different names. And multiformat LFs must use different names for each LF record format. -- Tom
    125,585 pointsBadges:
    report
  • 6r
    As per rule of multiformat logical file creation. The record format names corresponding to PFILE key word must be same of underlying PFs otherwise it will give below error while compiling multiformat logical file:- * CPD7916 30 2 Message . . . . : Record name not found in file specified on PFILE keyword.
    1,590 pointsBadges:
    report
  • TomLiotta
    I should have thought that you'd use an implicit field list. I haven't done it for so long that I didn't think of it. In general, you should always list the fields in your LF DDS source. When you list the fields, you can use any name for the record format name.   If you don't list the fields, there is a specific circumstance when you must use the record format name from the first PF named on the PFILE keyword:
    This is required if you do not specify 
    the FORMAT keyword and do not identify 
    individual fields by naming them in 
    this record format.
    So, provide the field list, or use the FORMAT keyword. I strongly recommend listing your fields. Specifically, list only the fields that are needed.   Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Multi-format!! -- I think you could just add a member from the new source and then delete the member from the old source.  Provided the logical file pfile keywords don't qualify the libraries.
    50,860 pointsBadges:
    report
  • 6r
    I have been listing the required fields but still can't compile my multiformat logical file because the recod formats of both the Physical files are same.And Ideally no multiformat logical file can ever be created if the physical files it's referring have common record format name. But here in this case when I see My PFs both have common record format name where as DSPFD on Multiformat logical file shows its based on two physical files who have the same record format name. So I am following only rule but i again wonder how would that LF (multiformat) have ever been created without giving that previously mentioned error code CPD7916. Thanks
    1,590 pointsBadges:
    report
  • philpl1jb
    Sounds like the logical should look something like this ( or perhaps not):
     R MYRECORD1    PFILE(MYLIBA/MYPF)
       MYFIELD1
       MYFIELD2
       MYFIELD3
     K MYFIELD1
     K MYFIELD3
     S MYFIELD2     EQ('ABC')
    
     R MYRECORD2    PFILE(MYLIBB/MYPF)
       MYFIELD11    RENAME(MYFIELD1)    
       MYFIELD12    RENAME(MYFIELD2)
       MYFIELD13    RENAME(MYFIELD3)
     K MYFIELD11
     K MYFIELD13
     S MYFIELD12     EQ('ABC')
    
    50,860 pointsBadges:
    report
  • TomLiotta
    Okay, I have two PFs named TESTPF and TESTPF2. They have the same DDS, same fields, same record format names. And I have TESTLFMF, a multiformat LF built over those two PFs.   Here is the DDS for TESTPF along with a snippet of DSPFD that shows record format name TESTPFF:
         A          R TESTPFF                   TEXT('Test a PF')
         A*
         A            PSATFG         2A
         A            PSSTCD         3P 0
         A            PSATST         1A
         A            PSATST3       25A
         A            PSATST2        1A
         A          K PSSTCD
    --------------------------------------
     5722SS1 V5R3M0  040528               Display File Description
       File  . . . . . . . . . . . : TESTPF
         Library . . . . . . . . . : *LIBL
       Type of information . . . . : *ALL
                                             Record Format List
                          Record  Format Level
     Format       Fields  Length  Identifier
     TESTPFF          5      31   4F560BDD12C39
    Here is the DDS for TESTPF2 along with a snippet of DSPFD that shows record format name TESTPFF:
         A          R TESTPFF                   TEXT('Test a PF')
         A*
         A            PSATFG         2A
         A            PSSTCD         3P 0
         A            PSATST         1A
         A            PSATST3       25A
         A            PSATST2        1A
         A          K PSSTCD
    --------------------------------------
     5722SS1 V5R3M0  040528               Display File Description
       File  . . . . . . . . . . . : TESTPF2
         Library . . . . . . . . . : *LIBL
                                             Record Format List
                          Record  Format Level
     Format       Fields  Length  Identifier
     TESTPFF          5      31   4F560BDD12C39
    The record formats have the same names. The have the same record format level ID which guarantees they are the same.   Now, here is the DDS for TESTLFMF along with a snippet of its DSPFD that shows the renamed record format for TESTPF2:
         A          R TESTPFF                   PFILE( TESTPF )
         A*
         A          K *NONE
         A*
         A          R RANDOMRF                  PFILE( TESTPF2 )
         A*
         A            PSATFG
         A            PSSTCD
         A            PSATST
         A            PSATST3
         A            PSATST2
         A*
         A          K *NONE
         A          S PSATFG                    COMP(EQ 'A')
         A          S PSSTCD                    COMP(LT 30 )
    --------------------------------------
     5722SS1 V5R3M0  040528               Display File Description
       File  . . . . . . . . . . . : TESTLFMF
         Library . . . . . . . . . : *LIBL
                                             Record Format List
                          Record  Format Level
     Format       Fields  Length  Identifier
     TESTPFF          5      31   4F560BDD12C39
     RANDOMRF         5      31   4FEE2B0B22B47
    The new record format name in the LF is RANDOMRF. It has the same fields as record formetTESTPFF, but I listed the fields. I also put in some Select-Omit specs just because I wanted to. The same fields are in the same buffer sequence, same data types and sizes, but there is a different record format name. For file TESTPF, I had to use the same record format name, TESTPFF, because I didn't list the fields.   That shows one implicit field list and one explicit field list. Implicit means that the system fills in the list of fields. Explicit means that the list of fields is coded in the DDS. The implicit example requires using TESTPFF as the format name, but the explicit list can be any "random" name as long as it's different from any other record format name in the LF.   It's important to mention Phil's earlier comment about RMVM and ADDLFM. If you have good control over the PFs and the LF, you can manipulate which PFs are accessed by the LF. Removing and adding file members is a useful way to do it. Any existing access path will be deleted when the member is removed and rebuilt when the new member is added.   Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    A multi-format without keys perhaps that's what's needed but that would be like an SQL without a Order By clause ... just plain wrong. 
    50,860 pointsBadges:
    report
  • TomLiotta
    Yeah, but it works either way. LFs without keys have had historical value; and under specific circumstances have even been necessary. Way back when, it wasn't possible to create LFs without keys. At that time, it was risky to have a key on the PF; so PFs generally had no keys. When LFs were eventually allowed not to have keys, it all changed. The specific risk of having keyed PFs disappeared, and database integrity could be much better maintained. The chance of object damage has been reduced so much since then that 'primary keys' for PFs should now be the norm. -- Tom
    125,585 pointsBadges:
    report
  • 6r
    in my case fields of both files are same and both are keyed.and both pfs have same recod format but still trying totrying either by giving the same record format name or giving different record format name(other tha PFs record format name) getting compilation error while creating Multiformat logical file.   Thanks  
    1,590 pointsBadges:
    report
  • TomLiotta
    in my case fields of both files are same and both are keyed.and both pfs have same recod format   That's the same as my example, so there shouldn't be a problem. You will need to show the DDS and the compile error. If we can't see it, we can't say what's wrong. My example shows that it works.   Tom
    125,585 pointsBadges:
    report
  • 6r
    your example works because it has some fields different than the first files.Some are keyed some are not keyed for example first one having selection criteria key *none second one there are many fields apart from key * none.
    1,590 pointsBadges:
    report
  • philpl1jb
    We cannot guess what your problems are.  In discussion use the CODE option on upper bar and paste your DDS and compile errors there. 
    50,860 pointsBadges:
    report
  • TomLiotta
    your example works because it has some fields different than the first files.Some are keyed some are not keyed   No. Sorry, you're wrong. That's why I posted the source. It works even if you make the keys exactly the same and make the field lists the same. I've already done it with the files that I posted.   The Select and Omit is not relevant, particularly because that criteria is always different from a PF because PFs cannot have those criteria. For the LF, you can make them anything without affecting the "format" Selection criteria aren't part of the formats. The format ID is not affect by Select nor Omit.   You're welcome to do it too. If it fails, you need to post the source and show the actual compiler errors. It isn't enough to say "it doesn't work." We need to see it.   Tom
    125,585 pointsBadges:
    report
  • 6r
    Ok, My Basic and simple question is Can A multiformat logical file based on two PFs who has same record formats and same fields (also key fields) ..every thing exactly same be created by giving same record format names as of those two PFs. Thanks
    1,590 pointsBadges:
    report
  • philpl1jb
    Discussion follows:
    Simple .. but is it.
    
    Ok, My Basic and simple question is:
    
     Can A multiformat logical file based on two PFs               ... YES
     who has same record formats and same fields (also key fields) ... YES
     ..every thing exactly same be created                         ... YES
     by giving same record format names as of those two PFs.       
        ??? ARE YOU USING THE SAME RECORD NAME FOR BOTH LF RECORDS ... NO
    
     Is that what you have .. two records in the LF with the same format name??
     In which case, if you have it, it must be possible, but it won't compile!!
    
    ......................................................
    But if that's true, then this is entirely wrong  !!!!
    ......................................................
    This isn't a multi-format logical file .. it's a multi-member logical file
    
    Create the logical file over one physical
    then use the addlfm to get the data from the second file.
    
    But of course that goes back the idea that you could use your origianl logical
    and add a logical file member over the missing file 
    and dltlfm over the one you don't want
     
    50,860 pointsBadges:
    report
  • TomLiotta
    once i do dspfd for lf. it shows two different recods formats.lf shows 2 separate recod formats for corresponding to 2 pfile keywords whereas   That was the first thing you said that indicated the LF was a "multiformat" LF. And later you said this:   But this multformat logical file which is based on these two pfs shows its based on these two files with giving two separate record format names under LF format .   If the existing LF shows two different format names and the two PFs have the same, single format name, then the LF is a "multiformat" LF. We don't actually know that because you still haven't shown us what you are trying to compile. You only tell us it won't compile.   Now you ask this question:   My Basic and simple question is Can A multiformat logical file based on two PFs who has same record formats and same fields (also key fields) ..every thing exactly same be created by giving same record format names as of those two PFs.   And the answer is "No."   You can't give the "multiformat" LF the same format names as the two PFs. One or both of the LF formats must be renamed.   No matter what, until you show us your DDS, we can't tell you what is wrong.   Phil showed an example. I showed a complete example that you can compile for yourself to prove that it works. We can't do more than that because you won't show us what you are doing.   Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    "The third worst poetry in the universe is written by Vogons, and frequently used as a form of torture."  Douglas Adams
    50,860 pointsBadges:
    report
  • TomLiotta
    "Second verse; Same as the first." -- Herman's Hermits
    125,585 pointsBadges:
    report
  • manuelhmoreno
    Hi.

    I suggest create two Logical Files when each one access  the corresponding physical files.

    Determine what library is present in your library list and then do an override data base file to the lógical file with the correct access to your physical file.


    Manuelh moreno
    10 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