recordName.resourceAssociation

When your program does an I/O operation against a record, the I/O is done on the physical file whose name is in the record-specific variable recordName.resourceAssociation. The variable is initialized in accordance with the resourceAssociation part used at generation time; for details, see Resource associations and file types. You can change the system resource name at run time by placing a different value in resourceAssociation.

In most cases, use the syntax recordName.resourceAssociation. You do not need to specify a record name, however, if EGL can determine the record that you intended, as is true in each of these cases:

You can use resourceAssociation as any of the following:

The characteristics of resourceAssociation are as follows:

Primitive type

CHAR

Data length

Varies by file type

Saved across segment?

Yes

Definition considerations

The value moved into recordName.resourceAssociation must be a valid system resource name for the system and file type that were specified when the program was generated. If more than one record specifies the same file name, modification of resourceAssociation for any record with that file name changes the setting of resourceAssociation for all records in the program with the same file name.

If a system resource identified in the setting of resourceAssociation is open when that record-specific variable is modified, the system resource that was in that variable is closed in the following circumstance: an I/O option runs against a record that has the same EGL file name as the record that qualifies resourceAssociation.

If two programs are using the same EGL file name, each of the record-specific resourceAssociation variables must contain the same value. Otherwise the previously opened system resource is closed when a new one is opened.

A comparison of resourceAssociation with another value tests true only if the match is exact. If you initialize resourceAssociation with a lowercase value, for example, the lowercase value matches only a lowercase value.

Files shared across programs

You can set the system resource name either at generation or at runtime:

At generation time

If two programs in the same run unit access the same logical file, you must specify the same system resource name for the logical file at generation to ensure that both programs access the same physical file at run time.

At run time

If you use recordName.resourceAssociation, each program that accesses the file must set resourceAssociation for the file. If two programs in the same run unit access the same logical file, each program must set resourceAssociation to the same system resource name to ensure that both programs access the same physical file at run time.

If a system resource is shared by multiple programs, each program that accesses the resource must set resourceAssociation to refer to the same resource. Also, if two programs in the same run unit access the same logical file, each program must set resourceAssociation to the same system resource name at generation time to ensure that both programs access the same system resource at run time.

MQ records

The system resource name for MQ records defines the queue manager name and queue name. Specify the name in the following format:

  queueManagerName:queueName

queueManagerName

Name of the queue manager.

queueName

Name of the queue.

As shown, the names are separated with a colon. However, queueManagerName and the colon can be omitted. The system resource name is used as the initial value for the record-specific resourceAssociation item and identifies the default queue associated with the record. For further details, see MQSeries support.

Example

  if (process = 1)
    myrec.resourceAssociation = "myFile.txt";
  else
    myrec.resourceAssociation = "myFile02.txt";
  end

Related concepts
MQSeries support
Resource associations and file types

Related reference
File and database (system words)