Page 1 of 1
New line character
Posted: Fri Nov 16, 2012 5:26 pm
by qutesanju
I have a job that prepares a sequencial file as
Total_Data_Count File_Count Filter_Count
100 10 20
is there a way that I can modify the sequencial file to as
Total_Data_Count,100
File_Count,10
Filter_Count,20
Posted: Sat Nov 17, 2012 12:39 am
by ray.wurlod
Looks like a straightforward pivot to me, after you've generated the column heading "values".
Posted: Sat Nov 17, 2012 3:29 am
by bhasds
Hi qutesanju,
You may try the below-
1.In stage variable of the transformer-
Code: Select all
SV1:",":col1 SV1 (initilize with null)
SV2:",":col2 SV2(initilize with null)
SV3:",":col3 SV3(initilize with null)
2. In derivation-
Execute the transformer stage in sequential mode.
3.In the Filter option of the sequential file stage-
Posted: Sat Nov 17, 2012 8:43 am
by chulett
I agree, it's just a pivot. Hard-code three new columns with the 'column names' and then pivot them with their matching data column. Write out the file without enabling the column headings option.
Posted: Sat Nov 17, 2012 9:41 am
by bhasds
Hi cutesanju
As Craig said if you drop the headers then a little change in the previous code-
In derivation, instead of this
SV1:"|":SV2:"|":SV3 outputcol
Use the below-
Code: Select all
Total_Data_Count:SV1:"|":File_Count:SV2:"|":Filter_Count:SV3 outputcol
The other things will remain same.
Posted: Mon Nov 19, 2012 2:52 am
by BI-RMA
Hi bhasds,
You are misinterpreting Craigs post: no transformer necessary, no stage-variables. Just a pivot-stage.
Posted: Mon Nov 19, 2012 3:31 am
by bhasds
Hi BI-RMA,
I am sorry for the misinterpretation.I had concentrated on changing my existing code in the previous post.
Posted: Mon Nov 19, 2012 7:37 am
by chulett
Of course, there are other games you can play. You could build and write out a single record much as posted but rather than the pipes separate the three segments with a line feed. You'll write out one record but anything reading it will read three:
Code: Select all
svLF = CHAR(10)
Output = 'Total_Data_Count,' : Col1 : svLF : 'File_Count,' : Col2 : svLF : 'Filter_Count,' : Col3
Again, make sure to
not enable column headers while writing.