Disk families are groups of disk units that are labeled with a common name and treated as a logical unit. Disk families are defined through system configuration and system commands. Once a family has been defined, a program can use the FAMILYNAME file attribute to specify that a file is located on that family.
It is quite often the case that all the input and output files used by a process are located on one, or possibly two, disk families. Now, suppose that you include FAMILYNAME file attribute assignments in the program for each file used by the program. The system administrator might later decide to change the name of a disk family, or might ask you to place your files on a different family. Further, you might need to run your program on a different host system, where no family of the original name exists. For any of these reasons, it might become desirable for the program to look for its files on a different family than is specified in the program code.
The simplest way to make a process use a different family is by assigning the FAMILY task attribute. This task attribute specifies a target family and one or two substitute families to be searched for files. For example, suppose a process expects to find its files on the family SYSPK. This is considered the target family. To make the process look for its files on the family PARTS instead, you could use the assignment FAMILY SYSPK = PARTS ONLY.
Note that this FAMILY value affects only files with a FAMILYNAME value of SYSPK. For example, if the file has a FAMILYNAME of DBFAM, then the process still looks for the file on DBFAM.
Note also that only one FAMILY value can be in effect at a time. For example, suppose the existing FAMILY value of a process is FAMILY SYSPK = PARTS ONLY. In this case, an assignment such as FAMILY DBFAM = PACK ONLY disables family substitution for the SYSPK family and enables substitution for the DBFAM family.
If a program does not specify a FAMILYNAME for a disk file, the system searches for the file on the family named DISK. If you want the users of a program to specify a FAMILY value, you can leave the FAMILYNAME unspecified for all the files. The user can override the default FAMILYNAME of DISK with a FAMILY task attribute assignment such as FAMILY DISK = DBFAM ONLY.
Sometimes it is useful to specify two substitute families in the FAMILY value. For example, you might have a WFL job that runs utilities stored on the family named DBFAM, which in turn use data files stored on the family named SYSPK. In this case, you can use a FAMILY statement like the one in the following WFL job:
?BEGIN JOB; FAMILY DISK = DBFAM OTHERWISE SYSPK; RUN OBJECT/DAILY/RUN; RUN OBJECT/REPORT/GENERATOR; ?END JOB
Because the FAMILY assignment is in the job header, the system searches for OBJECT/DAILY/RUN and OBJECT/REPORT/GENERATOR on DBFAM family and then on SYSPK family. The FAMILY task attribute value is inherited by both tasks, which search for their data files on DBFAM and SYSPK families.
When a family statement specifies two substitute families, the first is referred to as the primary family and the second as the alternate family. In the previous example, DBFAM is the primary family and SYSPK is the alternate family.
When a process attempts to create a new file on the target family, the system creates the file on the primary family instead. When a process attempts to open or execute an existing file on the target family, the process searches for the file first on the primary family and then on the alternate family. If the TITLE file attribute of the existing file does not begin with a usercode or an asterisk, then the system searches for the file in the following locations, in the order shown:
-
On the primary family, under the usercode of the process
-
On the primary family, as a nonusercoded file
-
On the alternate family, under the usercode of the process
-
On the alternate family, as a nonusercoded file
If the TITLE attribute of a file does not specify a usercode, and the NEWFILE file attribute is TRUE, the system creates the file on the primary family under the usercode of the process.
Another method for overriding the FAMILYNAME file attribute is through file equations, as described under Modifying File Attributes earlier in this section. The following are two advantages to using FAMILY instead of file equations for this purpose:
-
A single FAMILY assignment affects all the files in the program that have the specified target FAMILYNAME. Using file equations, you must specify each file individually.
-
The FAMILY assignment overrides the target FAMILYNAME wherever it is mentioned in the program. By contrast, file equations are applied when a file is first declared. The program can later use file attribute assignment statements to override the values supplied through file equations.
| Note: | The preceding description of family substitution applies only to files for which the SEARCHRULE file attribute value is NATIVE. For an explanation of the file searching rules used when SEARCHRULE = POSIX, refer to Specifying a Current Directory later in this section. |

