ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Superfluous logical files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Superfluous logical files

    I suspect the system I’m working on has more logical files than it needs. I’d like to get rid of as many of them as possible.

    For instance:

    Two files may be identical -- the same field list, same keys and same select/omit specs.

    Two files may have the same keys, but different field lists. Maybe the programs that use one logical file could be changed to use the other.

    That sort of thing.

    Do you know of anything that would help me locate superfluous logical files?


  • #2
    You can use DSPFD for a logical file to find out whether another file owns the access path. Look for "File owning access path" in the DSPFD output.

    This page https://www.ibm.com/docs/en/i/7.4?to...etween-logical says "When two or more logical files are based on the same physical files with the same key fields in the same order, they automatically share the same keyed sequence access path", although it goes on to list some other conditions that would cause the access path to be shared.

    But if one logical file uses the access path from another logical file, it doesn't necessarily mean they have the same keys. If you create LF1 first with keys A and B, and then create LF2 with just key A, then LF2 would use LF1's access path.

    I don't know whether there is also some SQL query that would give this information.

    Comment


    • #3
      Are you using native IO or SQL in RPG?

      If you are using native IO ( read, chain update etc ) then you can do a DSPPGMREF to a file
      and a dspfd to another file and then create a query that gives you the files not referenced.

      Another thing is to do a DSPOBJD to a file and find the files that haven't been referenced for a long period.
      These files can then be scrutinized. If only used in a few programs you could also check if the programs should
      be removed.

      Comment


      • #4
        Thanks for the suggestions. I had already been doing some things along these lines. I've identified several dozen logical files that we don't need. I even found two logical files with the exact same DDS. The search continues.

        Comment

        Working...
        X