Skip to main content

TRANS

Reads field data from a MultiValue file.

Synopsis

TRANS(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 defined data sections (data files), you can specify mvfile as either "filename,datasection" or simply "datasection".
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 TRANS 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, TRANS 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 quoted string.

Description

The TRANS 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 a TRANS.

The code argument determines how TRANS 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.
N Return the recID value if the specified field value is null.

The TRANS and XLATE functions are functionally identical.

Examples

The following example illustrates the use of the TRANS function:

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

See Also

FeedbackOpens in a new tab