XLATE function
Syntax
XLATE ( [DICT] filename, record.ID, field#, control.code)
Description
Use the XLATE function to return the contents of a field or an record in a InfoSphere® DataStage® file. XLATE opens the file, reads the record, and extracts the specified data.
filename is an expression that evaluates to the name of the remote file. If XLATE cannot open the file, a run-time error occurs, and XLATE returns an empty string.
record.ID is an expression that evaluates to the ID of the record to be accessed. If record.ID is multi-valued, the translation occurs for each record ID and the result is multi-valued (system delimiters separate data translated from each record).
field# is an expression that evaluates to the number of the field from which the data is to be extracted. If field# is -1, the entire record is returned, except for the record ID.
control.code is an expression that evaluates to a code specifying what action to take if data is not found or is the null value. The possible control codes are:
- X
- (default) Returns an empty string if the record does not exist or data cannot be found.
- V
- Returns an empty string and produces an error message if the record does not exist or data cannot be found.
- C
- Returns the value of record.ID if the record does not exist or data cannot be found.
- N
- Returns the value of record.ID if the null value is found.
The returned value is lowered. For example, value marks in the original field become subvalue marks in the returned value. For more information, see the LOWER function.
If filename, record.ID, or field# evaluates to the null value, the XLATE function fails and the program terminates with a run-time error message. If control.code evaluates to the null value, null is ignored and X is used.
The XLATE function is the same as the TRANS function.
Example
X=XLATE("VOC","EX.BASIC",1,"X")
PRINT "X= ":X
*
FIRST=XLATE("SUN.MEMBER","6100",2,"X")
LAST=XLATE("SUN.MEMBER","6100",1,"X")
PRINT "NAME IS ":FIRST:" ":LAST
This is the program output:
X= F BASIC examples file
NAME IS BOB MASTERS