Resource associations and file types
An EGL record that accesses an external file, printer, or queue has a logical file or queue name. (In the case of a printer, the logical file name is printer for most run-time systems.) The name can be no more than 8 characters and is meaningful only as a way of relating the record to a system name, which the target system uses to access a physical file, printer, or queue.
In relation to files or queues, the file or queue name is a default for the system name. In relation to printers, no default exists.
Instead of accepting a default, you can take one or both of these actions:
- At generation time, you control the generation process with a build descriptor that in turn references a specific resource associations part. The resource associations part relates the file name with a system name on the target platform where you intend to deploy the generated code.
- At run time (in most cases) you can change the value in the record-specific variable resourceAssociation (for files or queues) or in the system variable sysVar.printerAssociation (for print output). Your purpose is to override the system name that you specified either by default or by specifying a resource associations part.
The resource associations part does not apply to these record types:
- basicRecord, because basic records do not interact with data stores
- SQLRecord, because SQL records interact with relational databases
Resource associations part
The resource associations part is a set of association elements, each of which has these characteristics:
- Is specific to a logical file or queue name
- Has a set of entries, each specific to a target system; each entry identifies the file type on the target platform, along with the system name and in some cases additional information
You can think of an association element as a set of properties and values in a hierarchical relationship, as in the following example:
// an association element property: fileName value: myFile01 // an entry, with multiple properties property: system value: aix property: fileType value: spool property: systemName value: employee // a second entry property: system value: win property: fileType value: seqws property: systemName value: c:\myProduct\myFile.txtIn this example, the file name myFile01 is related to these files:
- employee on AIX
- myFile.txt on Windows 2000/NT/XP
The file name must be a valid name, an asterisk, or the beginning of a valid name followed by an asterisk. The asterisk is the wild-card equivalent of one or more characters and provides a way to identify a set of names. An association element that includes the following value for a file name, for example, pertains to any file name that begins with the letters myFile:
myFile*If multiple elements are valid for a file name used in your program, EGL uses the first element that applies. A series of association elements, for example, might be characterized by the following values for file name, in order:
myFile myFile* *Consider the element associated with the last value, where the value of myFile is only an asterisk. Such an element could apply to any file; but in relation to a particular file, the last element applies only if the previous elements do not. If your program references myFile01, for instance, the linkage specified in the second element supersedes the third element to define how the reference is handled.
At generation time, EGL selects a particular association element, along with the first entry that is appropriate. An entry is appropriate in either of two cases:
- A match exists between the target system for which you are generating, on the one hand, and the system property, on the other; or
- The system property has the following value:
any
If you are generating for AIX, for example, EGL uses the first entry that refers to aix or to any.
File types
A file type determines what properties are necessary for a given entry in an association element. The next table describes the EGL file types.
File type Description ibmcobol A VSAM file accessed remotely by an EGL-generated Java program. For details on specifying the system name in this case, see VSAM support. mq An MQSeries message queue; for details on how to work with such a queue, see MQSeries support. seqws A serial file accessed by an EGL-generated Java program. spool A spool file on AIX or Linux. Record types and VSAM
Each of three types of records is appropriate for accessing a VSAM data set, but only if the file type in the association element for the record is ibmcobol, vsam, or vsamrs:
- If the record is of type indexedRecord, the VSAM data set is a Key Sequenced Data Set with a primary or alternate index
- If the record is of type relativeRecord, the VSAM data set is a Relative Record Data Set
- If the record is of type serialRecord, the VSAM data set is an Entry Sequenced Data Set
For further details
For further details on resource associations, see these topics:
- Record and file type cross-reference
- Association elements
Related concepts
MQSeries support
Parts
Record types and properties
Record parts
VSAM support
Related reference
Association elements
Record and file type cross-reference
recordName.resourceAssociation
resourceAssociations
system
sysVar.printerAssociation