transformer
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 175
- Joined: Tue Oct 14, 2008 1:48 pm
transformer
Hi Everyone,
My design is
FF -------- XFM-------------FF
In my transformer i am deriving some columns and in one of the column I need the count of the source file.Without using aggragater can i achieve my goal inside the transformer.
Can anybosy help me out in this.
Thanks,
My design is
FF -------- XFM-------------FF
In my transformer i am deriving some columns and in one of the column I need the count of the source file.Without using aggragater can i achieve my goal inside the transformer.
Can anybosy help me out in this.
Thanks,
Rajesh Kumar
-
- Participant
- Posts: 43
- Joined: Thu May 29, 2008 8:41 pm
-
- Premium Member
- Posts: 457
- Joined: Tue Sep 25, 2007 4:05 pm
Re: transformer
Get another Sequential file stage which has two columns defined in it. Let the datatype of one of the fields be Integer/Varchar and the length depends on how big your row count is and the other is Character.kittu.raja wrote:Hi Everyone,
My design is
FF -------- XFM-------------FF
In my transformer i am deriving some columns and in one of the column I need the count of the source file.Without using aggragater can i achieve my goal inside the transformer.
Can anybosy help me out in this.
Thanks,
Code: Select all
DmyCol1 - Char(1)
RowCount - Integer or Character.
Code: Select all
echo "X|`wc -l {file name for which counts are required}`" > {another file to store this result}
Code: Select all
Sequential File 1 ----------- XFM ----------- LKUP/JNR ----------- Sequential File output
|
Sequential File 2 ---------------------------------
Vivek Gadwal
Experience is what you get when you didn't get what you wanted
Experience is what you get when you didn't get what you wanted
-
- Premium Member
- Posts: 132
- Joined: Tue Sep 04, 2007 11:38 am
- Location: NOIDA
Re: transformer
Hi
Exact command is
Exact command is
Code: Select all
echo "X|`ls -l {file name for which counts are required}|wc -l|bc`"
vivekgadwal wrote:Get another Sequential file stage which has two columns defined in it. Let the datatype of one of the fields be Integer/Varchar and the length depends on how big your row count is and the other is Character.kittu.raja wrote:Hi Everyone,
My design is
FF -------- XFM-------------FF
In my transformer i am deriving some columns and in one of the column I need the count of the source file.Without using aggragater can i achieve my goal inside the transformer.
Can anybosy help me out in this.
Thanks,In the job's before job sub-routine, execute the following command:Code: Select all
DmyCol1 - Char(1) RowCount - Integer or Character.
Read this file from the second Seq. file stage. In your XFM, generate a dummy column with the value 'X' in it and after this, join it with the second file's data. You job design would look like this:Code: Select all
echo "X|`wc -l {file name for which counts are required}`" > {another file to store this result}
Hope this helps...Code: Select all
Sequential File 1 ----------- XFM ----------- LKUP/JNR ----------- Sequential File output | Sequential File 2 ---------------------------------
Code: Select all
Code: Select all
Re: transformer
What? There's absolutely no need to "list" anything and I have no idea what role you think the "binary calculator" is playing here.meet_deb85 wrote:Exact command isCode: Select all
echo "X|`ls -l {file name for which counts are required}|wc -l|bc`"
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 457
- Joined: Tue Sep 25, 2007 4:05 pm
Re: transformer
Very true. The command that I gave should do the trick for the OP.chulett wrote:What? There's absolutely no need to "list" anything and I have no idea what role you think the "binary calculator" is playing here.meet_deb85 wrote:Exact command isCode: Select all
echo "X|`ls -l {file name for which counts are required}|wc -l|bc`"
Vivek Gadwal
Experience is what you get when you didn't get what you wanted
Experience is what you get when you didn't get what you wanted
-
- Premium Member
- Posts: 175
- Joined: Tue Oct 14, 2008 1:48 pm
Re: transformer
[quote="vivekgadwal"][quote="chulett"][quote="meet_deb85"]Exact command is
Code: Select all
Hi Everyone,
Thank you for the response.
I want it in transformer itself.
Can I do using stage variables if yes how can I achieve it.
If that it is not possible then I will use before sub routine.
Thanks,
Rajesh Kumar
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Premium Member
- Posts: 175
- Joined: Tue Oct 14, 2008 1:48 pm
-
- Premium Member
- Posts: 457
- Joined: Tue Sep 25, 2007 4:05 pm
Is there a problem creating a dummy file for the duration of the job's run? I guess what Sainath and even I want to know is, "why the insistence in having this within a transformer?" as there are other simple ways - the way I proposed for example - to do this!kittu.raja wrote:I have only one file and I want to count the number of records in a file using transformer.Sainath.Srinivasan wrote:What do you mean by 'count of source file' ?
If you have data from 5 files, will each data record carry 1,2,3,4,5 or will they all have 5 ?
Thanks,
Vivek Gadwal
Experience is what you get when you didn't get what you wanted
Experience is what you get when you didn't get what you wanted