Back-to-basics: File Definitions

Multi-value Solutions

Nathan Rector

Natec Systems

nater@northcoast.com

http://www.nortcoast.com/~nater/

File Definitions: (Pick Style)

A Multi-value file seems like a rather simple thing when a user first looks at it. You create the file with a TCL command or a menu option in your 4GL. All that needs to be done is specify the name and decide what size the file will be.

Many people create a file with a modulo, or sizing, of 1 and then rely on their re-sizing program to take care of the rest. This gives the user the ability to create a file anytime they want, but they miss all the additional features that allow the MIS manager to control access and functionality of the file.

There are several different file types in the Multi-value world. All files start with a 'd' in attribute 1. Although, there is more than just the standard file defintion of 'd':

dc - This file type is found on the older R83 style systems. It tells the operating system that the file is used to store binary information. This file type is used as pointer files and program files.

dx - This file type allows the file to exist only until the next restore. When a restore is done, neither the data nor the file exists.

dy - This file type is similar to the 'dx' file except that it keeps the file definition, but none of the data. This is good to use with temporary files that must always exist, but the data section is only used to store "one time use" data elements.

dl - This file type is new in the D3 and Advanced Pick systems. It is used in conjunction with the transaction logging system these operating systems have. A 'dl' file updates the transaction logger every time something is updated in the file.

dn - This file type works similar to the 'dl' file type. Again it is found in the D3 and Advanced Pick systems. The only difference is that it works the opposite of the 'dl' file type. No changes to the items in the file are logged in the transaction logger, even if the global transaction logging is on.

All files have 2 fields that allow the MIS manager the ability to control the update and retrieval rights to the information in the file.

Attributes 5 and 6 of the file definition hold the update and retrieval codes. Update and retrieval codes are character sequences that are used to lock retrieval and update to the files. Attribute 5 is the codes for retrieval, and attribute 6 is the codes for updates.

There is one quirk with these access codes working independent of each other. It is possible to lock a user from accessing information on a file, but still allow them to update the information in the file by not specifying an update lock. Be careful of this over sight.

The update and retrieval locks are keyed into the User Id, or on the R83 systems, System Q-pointers.

The following example illustrates how to use update and retrieval locks:

File: payroll

001 d

002 56678

003 23

004

005 finance

006 finance

007

008

009 l

010 10

User Id: John

006 inventory]finance

User Id: Joeann

006 Inventory

In the example above, the user 'John' has access to the payroll file, but the user 'Joeann' does not.

Update and retrieve codes can be very simple or very complex when setup. Be sure to plan them carefully before you implement them. Once you start using update and retrieval codes, you must keep using them or you will end up with holes in your security.

As you can see, there is more to creating a file than naming it and specifying its size.

Back-to-basics: File Definitions

Back-to-basics: File Definitions

Multi-value Solutions

Nathan Rector

Natec Systems

nater@northcoast.com

http://www.nortcoast.com/~nater/

File Definitions: (Pick Style)

A Multi-value file seems like a rather simple thing when a user first looks at it. You create the file with a TCL command or a menu option in your 4GL. All that needs to be done is specify the name and decide what size the file will be.

Many people create a file with a modulo, or sizing, of 1 and then rely on their re-sizing program to take care of the rest. This gives the user the ability to create a file anytime they want, but they miss all the additional features that allow the MIS manager to control access and functionality of the file.

There are several different file types in the Multi-value world. All files start with a 'd' in attribute 1. Although, there is more than just the standard file defintion of 'd':

dc - This file type is found on the older R83 style systems. It tells the operating system that the file is used to store binary information. This file type is used as pointer files and program files.

dx - This file type allows the file to exist only until the next restore. When a restore is done, neither the data nor the file exists.

dy - This file type is similar to the 'dx' file except that it keeps the file definition, but none of the data. This is good to use with temporary files that must always exist, but the data section is only used to store "one time use" data elements.

dl - This file type is new in the D3 and Advanced Pick systems. It is used in conjunction with the transaction logging system these operating systems have. A 'dl' file updates the transaction logger every time something is updated in the file.

dn - This file type works similar to the 'dl' file type. Again it is found in the D3 and Advanced Pick systems. The only difference is that it works the opposite of the 'dl' file type. No changes to the items in the file are logged in the transaction logger, even if the global transaction logging is on.

All files have 2 fields that allow the MIS manager the ability to control the update and retrieval rights to the information in the file.

Attributes 5 and 6 of the file definition hold the update and retrieval codes. Update and retrieval codes are character sequences that are used to lock retrieval and update to the files. Attribute 5 is the codes for retrieval, and attribute 6 is the codes for updates.

There is one quirk with these access codes working independent of each other. It is possible to lock a user from accessing information on a file, but still allow them to update the information in the file by not specifying an update lock. Be careful of this over sight.

The update and retrieval locks are keyed into the User Id, or on the R83 systems, System Q-pointers.

The following example illustrates how to use update and retrieval locks:

File: payroll

001 d

002 56678

003 23

004

005 finance

006 finance

007

008

009 l

010 10

User Id: John

006 inventory]finance

User Id: Joeann

006 Inventory

In the example above, the user 'John' has access to the payroll file, but the user 'Joeann' does not.

Update and retrieve codes can be very simple or very complex when setup. Be sure to plan them carefully before you implement them. Once you start using update and retrieval codes, you must keep using them or you will end up with holes in your security.

As you can see, there is more to creating a file than naming it and specifying its size.