Skip to main content

XLATE

Reads field data from a MultiValue file.

Synopsis

XLATE(mvfile,recID,fieldno,code)

Arguments

mvfile The name of a MultiValue file defined in the VOC. An expression that resolves to a string. If there are multiple data files, you can specify mvfile as either "dirname,datafile" or simply "datafile".
recID The record ID of the desired record. An expression that resolves to a string (commonly a positive integer). This argument can be multivalued in which case XLATE returns multivalues.
fieldno An expression that resolves to either an integer or a non-numeric string. If an integer, fieldno specifies the field number of the field to be read, or, if -1, returns the contents of the entire record. This usage is compatible with most MultiValue systems. If a non-numeric string, fieldno specifies an attribute to look up in the file's dictionary. If that attribute is a “D” data defining entry, XLATE looks up the data using the corresponding field number recorded in the dictionary. This usage is compatible with UniData systems.
code A letter code that specifies what to do if the requested record does not exist. An expression that resolves to a code string.

Description

The XLATE function returns a field value from a MultiValue file. Unlike a READ statement, you do not have to use the OPEN statement to open the MultiValue file before issuing an XLATE.

The code argument determines how XLATE should respond when you request an invalid field. The following are valid letter codes:

X Return an empty string if the specified record or field cannot be located.
V Return an empty string and generate an error message if the specified record or field cannot be located.
C Return the recID value if the specified record or field cannot be located or has an empty string value ("").
N Return an empty string if the specified record or field cannot be located.

The XLATE and TRANS functions are functionally identical.

Examples

The following example illustrates the use of the XLATE function:

mydyn = XLATE("TEST.FILE",1,1,X)
PRINT "the field value:",mydyn

See Also

FeedbackOpens in a new tab