The .ASSOCTABLE extended attribute (EA) contains information that associates data files with the applications that create them or that know how to use them. The .ASSOCTABLE extended attribute enables an application to indicate the type, extension, and icon for the data files it recognizes. The .ASSOCTABLE EA also contains an ownership flag. This tells OS/2 which application to run when the user double-clicks the mouse on a given data file.

Because programs can understand and reference data files generated by other programs, this EA can be used to link a program with those files.

The name of this EA consists of the string ".ASSOCTABLE". The value of this EA contains application information and consists of multi-valued, multi-typed fields that link the application with:

This data can be installed automatically by OS/2.

The format of the EA is as follows.

    EAT_MVMT 0000 0004 EAT_ASCII  .TYPE name                       EAT_ASCII   file extension
                       EAT_BINARY  flags
                       EAT_ICON    icon data

The source for the .ASSOCTABLE EA is contained in the resource file for an application. The .ASSOCTABLE EA is created using the Resource Compiler from a table with the following form:

    ASSOCTABLE  assoctable -id
    BEGIN
    association_name,[extension],[flags], [icon_filename]
    association_name,[extension],[flags], [icon_filename]
     .
     .
     .
    END

The association_name is the name of a file type that the Resource Compiler understands. (This is the same name found in the .TYPE field of data files.)

The extension is the three letter file extension that is used to identify files of this type, if they have no .TYPE EA entry. (Three letter extensions should be used so that FAT file systems can make use of this EA). This field can be empty.

The icon_filename is the name of the file that contains the icon that is to be used to represent this file type. (This field can also be empty.)

The .ASSOCTABLE flag indicates that the program is the default application for data files with the specified type. This determines the program OS/2 will start when the file is double-clicked with the mouse.

If more than one program has marked itself as the EAF_DEFAULTOWNER for a particular data file .TYPE, OS/2 will not know which program to run when the file of this .TYPE is double-clicked on with the mouse. If no program is marked as the EAF_DEFAULTOWNER for a particular data file .TYPE, OS/2 will be similarly confused. In both cases, OS/2 provides the user with a list of applications that understand the file .TYPE, regardless of whether the application is the owner or not. The user selects the program to run from this list.

The flag entry indicates whether the application owns the file or merely recognizes the .TYPE. If this flag is set, the entry describing data files of this type cannot be edited. This flag is specified if a previously defined icon in the ASSOCTABLE is to be reused. Entries with this flag set have no icon data defined. The icon used for this entry will be the icon used for the previous entry.

EAF_ flags can be ORed together when specified in the ASSOCTABLE. The EAF_ flags are defined in PMWIN.H and PMWIN.INC.

.ASSOCTABLE Example
For example, My_Company's application, My_Application, generates or references data files that have the following .TYPE names:

    My_Company My_Application documentation
    My_Company My_Application macros
    My_Company My_Application spreadsheet
    My_Company My_Application chart
    Your_Company Your_Application forecast

The source for the .ASSOCTABLE extended attribute in the resource file for My_Application could look like the following.

    ASSOCTABLE
    BEGIN
    "My_Company My_Application documentation", "DOC", EAF_DEFAULTOWNER, My_App.ICO
    "My_Company My_Application macros", "MAC", EAF_DEFAULTOWNER+EAF_REUSEICON
    "My_Company My_Application spreadsheet", "SPR", EAF_DEFAULTOWNER+EAF_REUSEICON
    "My_Company My_Application chart", "CHT", EAF_DEFAULTOWNER+EAF_REUSEICON
    "Your_Company Your_Application forecast", "FOR", 0
    END

My_Application can load and use some files generated by Your_Application. However, because My_Application is not the default owner of those files, OS/2 does not run My_Application when the user double-clicks on the files with the mouse.

The following example illustrates how the value of the .ASSOCTABLE EA for My_Application might look. It is a multi-valued, multi-typed EA with five multi-valued, multi-typed entries (one for each file type referenced or generated by the application).

    EAT_MVMT   0000 0005          ; There are 5 associated file types

    EAT_MVMT   0000 0004          ; Description of 1st associated file type
    EAT_ASCII  0027 My_Company My_Application documentation  ; File type
    EAT_ASCII  0003 DOC           ; File extension
    EAT_BINARY flags              ; Flags
    EAT_ASCII  icon data          ; Physical icon data

    EAT_MVMT   0000 0004          ; Description of 2nd associated file type
    EAT_ASCII  0020 My_Company My_Application macros
    EAT_ASCII  0003 MAC
    EAT_BINARY flags
    EAT_ICON   icon data

    EAT_MVMT   0000 0004          ; Description of 3rd associated file type
    EAT_ASCII  0025 My_Company My_Application spreadsheet
    EAT_ASCII  0003 SPR
    EAT_BINARY flags
    EAT_ICON   icon data

    EAT_MVMT   0000 0004          ; Description of 4th associated file type
    EAT_ASCII  001F My_Company My_Application chart
    EAT_ASCII  0003 CHT
    EAT_BINARY flags
    EAT_ICON   icon data

    EAT_MVMT   0000 0004          ; Description of 5th associated file type
    EAT_ASCII  001F Your_Company Your_Application forecast
    EAT_ASCII  0003 FOR
    EAT_BINARY flags
    EAT_ICON   icon data


[Back] [Next]