View Data

Logical Files
We have several master files that contain 2 companies data. Right now our system allows each company to view each other's data. I need to only allow each company to view their own data. Each file has a company code that I can use. Currently each file contains several logicals now that we use to search by name, dba, etc. So I am not sure if using a logical is the best way. I was thinking about views but I am not as familiar with them. Any suggestions?

Answer Wiki

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


My preferred method would be to split the data into 2 libraries – maybe you could have a common library for files / tables which both companies need to access.

<b>!!! Make sure you have a full backup before you try anything like this !!!</b>

Assuming you want to use company 01 and company 02 – create a duplicate of the current library as libnam02, rename the existing library as libnam01. Use SQL to remove the company 01 data from the libnam02 library. Use SQL to remove the company 02 data from the libnam01 library. Create a common library for the common data files (files which don’t have company codes). Copy or move the files without company codes to the common library and remove them from both libnam01 and libnam02 libraries.

Setup your separate users to have the correct libnamxx library at the top of their library list, followed by the common library.

This should work in many cases – Of course it all depends on how your software works and how your system is setup. Also bear in mind that any changes you make to files may have to be done in both company libraries in the future.


Martin Gilbert.

Discuss This Question: 2  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.
  • graybeard52
    A view ends up being basically the same thing as a LF, except it has no keys and response is usually slower (since the system doesn't keep it up-to-date like it does a LF). Another option is to create 2 libraries (one for each company) , and put the LF's in them (one for each company). That way the LF's can have the same name as the PF. Not something I like to do, but it can make working with 3rd party pgms easier, and reduce OVRDBF issues. Comp 1 LIBL COMPLIB1, MAINLIBR, etc Comp 2 LIBL COMPLIB2, MAINLIBR, etc The comp 1 user will get the LF in COMPLIB1, etc,
    3,115 pointsBadges:
  • GAC
    Creating a view or logical file is a technical viable solution. Nonetheless, splitting each company’s data into two different libraries is a better approach, from my perspective. Besides the possibility to do it (views) there are other considerations you might like to have: security and convenience. Having each company’s data on different libraries simplifies security because you manage security at the library level instead of having to implement it at object level (and maybe even programmatically). If the time comes when a third company must be added, you just simply mount the libraries structure for the company without having to change the programs. Gerardo Agüero.
    300 pointsBadges:

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.


Share this item with your network: