Variable length records

Hi,

I need to extract and validate data from file with fix-length .It has multiple records of different structure.Value of a field RECID identifies the record as header,detail or trailer record.RECID with value H1234 will be header,RECID with value D1234 will be detail and RECID with value T1234 will be trailer. File will have data in following format

H1234 12345 12345678901234567890 abcde
D1234 12345 12345678901234567890 abcde abcde abc123 90
D1234 12345 12345678901234567890 abcde abcde abc123 70
T1234 12345 12345678901234567890

Please advice how above requirement can be acheived by CloverETL.

It is not possible to do it in one step. You have to read all data (one field with eol delimiter or mixed metadata) and then partition them. After partitioning you can write them to different files (and they are prepared for reading now) or validate in Reformat or Filter node.

Hello,
since 2.5 ver. you can use Reformat component with following transform function:

function transform() {
	string f4 = null;
	string f5 = null;
	string f6 = null;
	string f7 = null;
	int recType;
	list tmp = split($field3,' ');
	if (char_at($Field1,0).eq.'H') recType = 0; 
	else if (char_at($Field1,0).eq.'D') recType=1;
	else recType = 2;
	if (length(tmp) > 1) f4 = tmp[1];
	if (length(tmp) > 2) f5 = tmp[2];
	if (length(tmp) > 3) f6 = tmp[3];
	if (length(tmp) > 4) f7 = tmp[4];
	$0.field1 := $0.Field1;
	$1.field1 := $0.Field1;
	$2.field1 := $0.Field1;
	$0.field2 := $0.field2;
	$1.field2 := $0.field2;
	$2.field2 := $0.field2;
	$0.field3 := tmp[0];
	$1.field3 := tmp[0];
	$2.field3 := tmp[0];
	$0.field4 := f4;
	$1.field4 := f4;
	$1.field5 := f5;
	$1.field6 := f6;
	$1.field7 := f7;
	return recType
}