ITYPE function
Syntax
ITYPE (i.type)
Description
Use the ITYPE function to return the value resulting from the evaluation of an I-descriptor expression in an InfoSphere® DataStage® file dictionary.
i.type is an expression evaluating to the contents of the compiled I-descriptor. The I-descriptor must have been compiled before the ITYPE function uses it, otherwise you get a run-time error message.
i.type can be set to the I-descriptor to be evaluated in several ways. One way is to read the I-descriptor from a file dictionary into a variable, then use the variable as the argument to the ITYPE function. If the I-descriptor references a record ID, the current value of the system variable @ID is used. If the I-descriptor references field values in a data record, the data is taken from the current value of the system variable @RECORD.
To assign field values to @RECORD, read a record from the data file into @RECORD before invoking the ITYPE function.
If i.type evaluates to the null value, the ITYPE function fails and the program terminates with a run-time error message.
Example
This is the SUN.MEMBER file contents:
AW
F1: ACCOUNTING
TRX
F1: MARKETING
JXA
F1: SALES
This is the DICT.ITME contents:
DEPARTMENT
F1:D
2:1
3:
4:
5:10L
6:L
This is the program source code:
OPEN 'SUN.MEMBER' TO FILE ELSE STOP
OPEN 'DICT','SUN.MEMBER' TO D.FILE ELSE STOP
*
READ ITEM.ITYPE FROM D.FILE, 'DEPARTMENT' ELSE STOP
*
EXECUTE 'SELECT SUN.MEMBER'
LOOP
READNEXT @ID DO
*
READ @FRECORD FROM FILE, @ID THEN
*
PRINT @ID: "WORKS IN DEPARTMENT" ITYPE(ITEM.ITYPE)
END
REPEAT
STOP
END
This is the program output:
3 records selected to Select List #0
FAW WORKS IN DEPARTMENT ACCOUNTING
TRX WORKS IN DEPARTMENT MARKETING
JXA WORKS IN DEPARTMENT SALES